<div dir="ltr"><div>let a: Int? = 3</div><div>if case let b? = a {</div><div> print(b)</div><div>}</div><div><br></div><div>works for me in Swift 2.2. Have they announced that they're taking this away?</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Dec 6, 2015 at 4:38 PM, Tyler Mandry via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">
What isn't clear to me from Chris's or John's comments is why the `if let x? = foo` syntax was taken away. Was it for backward-compatibility? To me, this syntax does have special syntactic support, and also seems to make it clearer what's going on. It's also analogous to Swift's type inference for generic <T?> types, for example:
<div>
<br>
</div>
<div>
func doSomething<T? where T: Equatable>(x: T?) -> T { ... }
</div>
<div>
<div>
<br>
</div>
<div>
Note the T? in brackets. If I pass an Int? to doSomething, the type is "unwrapped" and T becomes Int. It seems like `if let x? = foo` would follow the same pattern.
</div>
<div>
<br>
</div>
<div>
Was the syntax taken away for reasons unlikely to change, or is it up for discussion? :)
</div><span class="HOEnZb"><font color="#888888">
<div>
<br>
</div>--
<br>
<div>
Tyler Mandry
</div>
</font></span></div><span class="HOEnZb"><font color="#888888">
</font></span></div><span class="HOEnZb"><font color="#888888">
<div style="margin-top:10px;font-size:12px;font-family:Helvetica,Arial;color:#999"><br></div></font></span><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div></div>