<div dir="ltr">Currently,<div><br><div>if case let x? = y { ... }</div><div><br></div><div>is a sugared version of:</div><div><br></div><div>if case let .some(x) = y { ... }</div></div><div><br></div><div>which is in turn a sugared version of:</div><div><br></div><div>if case .some(let x) = y { ... }</div><div><br></div><div>Pattern matching in `if` works like this: left hand side of `=` contains supposed structure of value at right hand side.</div><div>If we omit `case`, we get:</div><div><br></div><div>if let x? = y { ... }<br></div><div><br></div><div>Another example: checks if tuple contains two `.some`:</div><div><br></div><div>if let (x?, y?) = z { ... }</div><div><br></div><div>- Anton</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-05-02 13:25 GMT+03:00 Haravikk <span dir="ltr">&lt;<a href="mailto:swift-evolution@haravikk.me" target="_blank">swift-evolution@haravikk.me</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><blockquote type="cite"><span class=""><div>On 1 May 2016, at 09:12, Антон Жилин &lt;<a href="mailto:antonyzhilin@gmail.com" target="_blank">antonyzhilin@gmail.com</a>&gt; wrote:</div></span><div><div dir="ltr"><span class=""><div><br></div><div>Pattern binding for optionals will look like:</div><div><br></div></span><div>if let x? = y { … }</div></div></div></blockquote><br></div><div>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><br></div><div>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><br></div><div><font face="Monaco"><span style="white-space:pre-wrap">        </span>if let x = y? { … } // More like optional chaining, which is familiar as an “if non-nil proceed” behaviour</font></div><div><font face="Monaco"><span style="white-space:pre-wrap">        </span>if let x ?= y { … } // More obviously a special type of assignment that could fail if y is nil</font></div><div><br></div><div>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></div>