[swift-evolution] [Review] SE-0030 Property Behaviors

Brent Royal-Gordon brent at architechies.com
Fri Feb 19 23:36:01 CST 2016


> What's to keep us from just treating `initialValue` as similar magic within a behavior declaration? Is it a matter of not wanting to use additional storage if the initial value isn't referenced?

The issue is that some behaviors want to initialize an internal property with an initial value (most of them, but let's use `@synchronized` as an example), some want to re-initialize from that value later (`@lazy`), and some don't want an initial value at all (`@deferred`). Unless we're going to scan the behavior's implementation and try to guess the semantics it wants, we're going to need to declare the desired semantics explicitly. And that means we need a syntax to declare the initial value semantic.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list