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

Joe Groff jgroff at apple.com
Thu Jan 28 12:03:18 CST 2016


> On Jan 28, 2016, at 12:43 AM, Brent Royal-Gordon <brent at architechies.com> wrote:
> 
>> 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)
> 	}
> 	print(bar)

Good idea.

-Joe


More information about the swift-evolution mailing list