> Why would you have an immutable instance member that is always going to have 
> a constant value of 1?  That just wastes space by duplicating the constant 
> value in many instances.  However it is quite reasonable to have an immutable 
> instance member that defaults to 1, but may have a different value depending 
> on the initializer that is used for the instance.
All true:
"let n = 1" is useless, and it would be useful to take this as a hint for the 
generated initializer… but it would break the rules for let.

Afair, in an older version of Swift, you could change the value of constants in 
init (I think it was changed when delayed assignment for constants was 
introduced).
Is this false memory, or does anyone know about the motivation for that change?
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to