[swift-evolution] Initializers

David Hart david at hartbit.com
Tue Jan 31 00:43:28 CST 2017


> On 30 Jan 2017, at 23:08, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> On Jan 30, 2017, at 12:36 PM, Robert Widmann via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> This seems to contradict Swift’s goal of being safe by default, no?  It would make me incredibly uncomfortable if there were a backdoor in DI, even if that backdoor emitted traps when it fails.
> 
> There already is a backdoor of sorts. This is one of the intended use cases for implicitly-unwrapped optionals. If you don't want to be hassled by DI, declare a property as T! type, and it will be implicitly initialized to nil, and trap if you try to use it as an unwrapped T without initializing it first.

And we've been trying to close that door 🚪 :)

> -Joe
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list