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

Craig Cruden ccruden at novafore.com
Fri Jan 22 16:39:11 CST 2016

I would think the concept of having var on pattern matching at least to be…. problematic since the pattern matching variable would be part of what you are matching.  

I would actually prefer pattern matching to be able to infer (hoping) the let since it really looks like horrible clutter on the case statements with regards to pattern matching.

> On 2016-01-23, at 4:14:54, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> on Fri Jan 22 2016, David Waite <swift-evolution at swift.org> wrote:
>> -1 for the reversal, because I have been burned by this myself.
>> The var parameters, cases, and “if var” could all be interpreted as
>> either making a copy or having inout semantics. The problem is that
>> the syntax doesn’t make the behavior explicit. IMHO you should be
>> striving not for a reversal but for a counterproposal.
> Hmm, so is this clear or surprising?
>  var y = 0
>  var x = y
>  x += 1
>  print(y)    // prints 0
> If it's unsurprising, can you explain why it's different from var in
> all the other contexts?
> -- 
> -Dave
> _______________________________________________
> 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