One thing I've had bit me is the lack of some sort of confirmation, see this example.
I have a objective-c method in a library like so: - (void)observe:(CallbackBlock)block; The CallbackBlock is a type def-ed block like so: typedef void (^CallbackBlock)(FDataSnapshot *snapshot); The parameter in the block gets converted into a IUO, I ended up releasing an app that crashed due to that IUO being nil. The code that crashed was something like this object.observe { $0.doSomething() } There is no way to tell that the $0 was a IUO. The compiler didn't force me to confirm in it in some way using a ! and unless I remembered to check the header I would have a crash. How would this work under your proposal ? *___________________________________* *James⎥Head Of CEO* *ja...@supmenow.com <ja...@supmenow.com>⎥supmenow.com <http://supmenow.com>* *Sup* *Runway East * *10 Finsbury Square* *London* * EC2A 1AF * On Fri, Mar 18, 2016 at 6:53 AM, Brent Royal-Gordon via swift-evolution < swift-evolution@swift.org> wrote: > > (Come to think of it, is there a cost to converting between `T?` and > `T!`, or do they get optimized into the same thing?) > > I can't imagine there would be. @autounwrapped (or whatever) is a purely > compile-time thing which tells the compiler to automatically insert a `!` > operator if it will make the expression typecheck. Other than that > compile-time behavior, `!` is an exact synonym for `?`. > > -- > Brent Royal-Gordon > Architechies > > _______________________________________________ > swift-evolution mailing list > swift-evolution@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution >
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution