[swift-evolution] Protocols and var { get }
Brent Royal-Gordon
brent at architechies.com
Fri Jan 29 21:01:45 CST 2016
> So what about protocols requiring ‘var … { get }’ syntax for read only properties? Is there some sort of underlying reason for this confusing syntax instead of ‘let …’? Now that Swift allows deferred initialization of lets does this requirement make sense?
`let` doesn't mean "no setter", it means "constant". For instance, you can't make a `weak let`, because the `weak` implies the variable can be nilled. There's no way to require a constant in a protocol, but if there were one, that's what `let ...` would mean.
--
Brent Royal-Gordon
Architechies
More information about the swift-evolution
mailing list