<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Ah, I’m just thinking about it in terms of too narrow a case, that makes sense! Put me down as a +1 for the change and solution then.</div><br class=""><div><blockquote type="cite" class=""><div class="">On 2 May 2016, at 11:56, Антон Жилин <<a href="mailto:antonyzhilin@gmail.com" class="">antonyzhilin@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Currently,<div class=""><br class=""><div class="">if case let x? = y { ... }</div><div class=""><br class=""></div><div class="">is a sugared version of:</div><div class=""><br class=""></div><div class="">if case let .some(x) = y { ... }</div></div><div class=""><br class=""></div><div class="">which is in turn a sugared version of:</div><div class=""><br class=""></div><div class="">if case .some(let x) = y { ... }</div><div class=""><br class=""></div><div class="">Pattern matching in `if` works like this: left hand side of `=` contains supposed structure of value at right hand side.</div><div class="">If we omit `case`, we get:</div><div class=""><br class=""></div><div class="">if let x? = y { ... }<br class=""></div><div class=""><br class=""></div><div class="">Another example: checks if tuple contains two `.some`:</div><div class=""><br class=""></div><div class="">if let (x?, y?) = z { ... }</div><div class=""><br class=""></div><div class="">- Anton</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">2016-05-02 13:25 GMT+03:00 Haravikk <span dir="ltr" class=""><<a href="mailto:swift-evolution@haravikk.me" target="_blank" class="">swift-evolution@haravikk.me</a>></span>:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><br class=""><div class=""><blockquote type="cite" class=""><span class=""><div class="">On 1 May 2016, at 09:12, Антон Жилин <<a href="mailto:antonyzhilin@gmail.com" target="_blank" class="">antonyzhilin@gmail.com</a>> wrote:</div></span><div class=""><div dir="ltr" class=""><span class=""><div class=""><br class=""></div><div class="">Pattern binding for optionals will look like:</div><div class=""><br class=""></div></span><div class="">if let x? = y { … }</div></div></div></blockquote><br class=""></div><div class="">Would take a little getting used to, but I think I’d be fine with it, as the way things are now is inconsistent with regular assignments (which remain optional).</div><div class=""><br class=""></div><div class="">My only concern is why the question mark on the left hand side? I don’t really have any concrete reason against it, but it just feels kind of odd to me, I’m just hoping for some reasoning why some of the alternatives aren’t better fits like:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class=""><span style="white-space:pre-wrap" class="">        </span>if let x = y? { … } // More like optional chaining, which is familiar as an “if non-nil proceed” behaviour</font></div><div class=""><font face="Monaco" class=""><span style="white-space:pre-wrap" class="">        </span>if let x ?= y { … } // More obviously a special type of assignment that could fail if y is nil</font></div><div class=""><br class=""></div><div class="">Again, I’m in favour, I’m just curious why the mentioned format, were others considered previously, or is just because that’s how the case-keyword form does it? (I don’t use it as I’ve never liked that form, and it doesn’t seem that well known anyway).</div></div></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>