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

John McCall rjmccall at apple.com
Mon May 2 16:59:56 CDT 2016


> On May 2, 2016, at 2:17 PM, David Hart <david at hartbit.com> wrote:
> John,
> 
> When the core team implemented the `if let x? = y` experiment and later backtracked, were you enthusiastic about it? The way Jordan puts it "Yeah, as nice as it sounds, it didn’t work out in practice.” sounds very definite, as if it was an obvious and unanimous decision to backtrack.

I wouldn't say it "didn't work out in practice."  It's not like we ran into some design/implementation hurdle that we weren't expecting.  We had adopters who were annoyed at having to make a pervasive change by hand that they felt wasn't an improvement.  I felt then (and continue to feel) that it would have been fine if we had spelled it with a question mark to begin with; but since we didn't, it was seen as a pointless regression in the amount of punctuation in Swift code, which was a very sensitive topic at the time.

And you know, that's okay.  Language design is design, not art; our goal here is to make a great tool that helps people, not to make a perfect self-consistent expression of an idea.  If we can do both, wonderful, but if we can't, well, it's pretty nice to have users.

John.


More information about the swift-evolution mailing list