[swift-evolution] Extending init checks for property initialization

Chris Lattner clattner at apple.com
Sat Apr 30 00:13:48 CDT 2016


> On Apr 28, 2016, at 5:49 PM, David Sweeris via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> On Apr 28, 2016, at 11:50 AM, Vladimir.S via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> I think I like this idea. It is clear that it is init() and 'defer' says that it is called at the end of each init. IMO we need exactly some kind of 'init' as only in init we can set un-initialized stored properties.
>> 
>> But, why implicitly unwrapped optionals are not solution here? I.e.
> 
> To avoid the extra overhead. Also, they’re sorta going away in Swift 3: https://github.com/apple/swift-evolution/blob/master/proposals/0054-abolish-iuo.md

SE-0054 shouldn’t eliminate use of IUO’s for properties that are “delay initialized”.  The only effect it will have is that it will prevent downstream references to those properties from accidentally propagating the IUO’ness.

-Chris


More information about the swift-evolution mailing list