[swift-evolution] [Idea] Find alternatives to `switch self`

Brent Royal-Gordon brent at architechies.com
Wed Mar 23 17:56:30 CDT 2016


> As "isRed" is declared as "var", I would expect it can be changed, but it's redeclared "let" afterwards…

Sorry, that was a mistake on my part. I originally wrote all of the definitions as `let variable = value`, assuming Swift would optimize that into a single instance shared by all instances of a particular case. But upon further reflection I realized that this wouldn't work properly if the property returned an object, so I decided to change them to computed properties. When I did that, I forgot to change the `let`s to `var`s.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list