It appears that trying to assign a variable to itself is an error:

var foo = 5
foo = foo // error: assigning a variable to itself

However, I was thinking about this and was wondering why this is an error and 
not a warning. If, for example, the assignment had a side effect (e.g. a didSet 
block) I’d think it would be warning, possibly ignorable with a set of 
parentheses. Thoughts?

Saagar Jha

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to