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

Dave Abrahams dabrahams at apple.com
Fri Jan 22 15:14:54 CST 2016


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



More information about the swift-evolution mailing list