[swift-evolution] [Idea] Remove optional pattern binding

John McCall rjmccall at apple.com
Mon May 2 13:12:00 CDT 2016


> On May 2, 2016, at 9:39 AM, Jordan Rose via swift-evolution <swift-evolution at swift.org> wrote:
>> On May 1, 2016, at 13:09, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>>> Pattern binding for optionals will look like:
>>> 
>>> if let x? = y { ... }
>> 
>> I suggested precisely this in February. The core team shot it down:
>> 
>>> We tried this* and got a lot of negative feedback. Optionals are unwrapped too often for people to be comfortable writing "if let name? = optionalCondition".
>> 
>> 
>> https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160201/008964.html
>> 
>> Having said that, this still seems like a good idea to me, but they're the ones with implementation experience; all I have is an elegant idea.
> 
> Yeah, as nice as it sounds, it didn’t work out in practice. I’ll add it to the frequently-suggested list.

Yeah.  My take on it is that 'if let' was probably a mistake, but once we made it, it was really hard to back out.

John.


More information about the swift-evolution mailing list