SE-0345: `if let` shorthand for shadowing an existing optional variable

What is your evaluation of the proposal?

Is it cheating to say +∞?

Is the problem being addressed significant enough to warrant a change to Swift?

Not only is it a significant enough change for Swift, it's a significant change for my source code. I suspect a lot refactoring of if let x = x code is in my future.

Does this proposal fit well with the feel and direction of Swift?

One of the early goals of Swift was to make a language that was approachable both to developers coming from other languages and, more importantly, to beginners. I think this proposal helps with that by being more readable and an gentler introduction into optional values.

If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?

I have not.

How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

More than a quick reading, less than in-depth study.

I've been following this work since the beginning. I think @cal has done a great job of taking that initial idea and making it concrete with both a proposal and implementation.

I'm looking forward to using this new feature.

-ch

14 Likes