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

Taras Zakharko taras.zakharko at uzh.ch
Mon Jan 25 04:20:17 CST 2016


It is true that the proposal seems a bit rushed. Removing ‘var’ in function declarations is a very good move, and I can partially understand its removal in if etc. (even though I disagree that it is that confusing, and its certainly useful as pointed out in this thread), but my biggest gripe is with removal of var in the guard statement. What about a useful pattern like this?

guard var x = SomeOptionalValue() else {
   fatalError()
}

x = doSomethingWith(x)

Best, 

 Taras

> On 25 Jan 2016, at 10:54, Quinn The Eskimo! via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
> On 25 Jan 2016, at 03:25, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> 
>> On 25 Jan 2016, at 01:44, Charles Srstka via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>>> 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.
> 
> One explanation might be that these folks have a Pascal heritage, where "var" is (roughly) equivalent to Swift's "inout".
> 
> Share and Enjoy
> --
> Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
> 
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list