[swift-evolution] Obsoleting `if let`
Paul Ossenbruggen
possen at gmail.com
Thu Feb 4 00:36:15 CST 2016
> On Feb 3, 2016, at 10:28 PM, Chris Lattner <clattner at apple.com> wrote:
>
>
>> On Feb 3, 2016, at 10:23 PM, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:
>>
>>> The original proposal says
>>>
>>> if let name? = optionalCondition { }
>>>
>>> This would unwrap it?
>>>
>>> This seems like it should be mean the opposite.
>>
>> The reason it unwraps it is that the thing on the left is a pattern, kind of like the cases of a case statement:
>
> Right. This makes sense to you, it makes sense to me, but it doesn’t make sense to most people using Swift. More specifically, you can get a *long* way in Swift without understanding the depth of how pattern matching works in Swift, but if/let is inescapable.
>
> -Chris
Which is why the “case" is there to help people make that association. It makes people think of pattern matching. I think that is an important distinction so I would say -1 to this proposal.
More information about the swift-evolution
mailing list