[swift-evolution] Reconsidering SE-0003 Removing var from Function Parameters and Pattern Matching

Dave Abrahams dabrahams at apple.com
Sun Jan 24 21:25:16 CST 2016


on Sun Jan 24 2016, Charles Srstka <cocoadev-AT-charlessoft.com> wrote:

>> On Jan 24, 2016, at 12:31 PM, Dave Abrahams via swift-evolution
>> <swift-evolution at swift.org> wrote:
>> 
>> on Sun Jan 24 2016, David Owens II <swift-evolution at swift.org
>> <mailto:swift-evolution at swift.org>> wrote:
>> 
>>> Removing var from function params, I get that. But the if-binding is
>>> unfortunate. It's literally a line of code for the sole purpose of
>>> making the compiler happy.
>> 
>> That's not the purpose; even though I am not a fan of prohibiting "var"
>> there, I understand that the purpose of doing so is avoiding confusion,
>> because some people believe they are getting a reference through which
>> to mutate the contents of the original optional.
>
> But that’s not what assigning something to a var means in any other
> context. Why should it be any different here?

I made the same argument myself, but you can't argue with empirical
evidence: some people have been tripped up by this anyway.

-- 
-Dave


More information about the swift-evolution mailing list