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

Brent Royal-Gordon brent at architechies.com
Thu Jan 28 02:43:23 CST 2016

> We have a lot of evidence that 'if var' confuses peopleā€”a lot of users think that 'if var' and 'var' bindings in case patterns will write back to the original value when this isn't the case.

Can we address this with a diagnostic?

	var bar: Int? = 1
	if var foo = bar {
		foo += 1	// Warning: Value is never used after modification (foo is a copy, not an alias)

Brent Royal-Gordon

More information about the swift-evolution mailing list