* What is your evaluation of the proposal?
I think this is a positive step in the right direction but I think there still
needs to be more amendments. So a +1 if address the issues I'm about to outline.
Anything not annotated should be imported as an optional not a IUO, this makes
it safer to handle the nil case with legacy code.
This is also truer to the intent of the original objective c code.
The proposal so far agrees with this, however there is one part I think could
make clearer.
This:
Let x: Int! = 5Let y = x
It's not clear to me that y would be converted to an optional or that it would
crash if it couldn't be type converted. This is a huge departure from the
existing swift.
I think it would be better to have what I call Optional Type Confermence.
If I want y to be a Int! I can refer to x with a ! :
Let x:Int! = 5Let y = x!
That way if x is nil the app will trap and this provides a path for existing
code to still use this behaviour plus it's now obvious that x will be treated
like an unwrapped optional.
If you wanted x to be treated like an optional you would use ?
Let x: Int! = 5Let y = x?
This would make the behaviour the proposal is proposing much clearer. * Is
the problem being addressed significant enough to warrant a change to
Swift?Although the proposal doesn't outline a problem, I do believe the
optional system in swift today isn't safe enough. Indeed I released an app that
crashed due to swift importing an unannotated piece of objective c code that
wasn't clear about how it was an IUO and crashed.Anything that improves this
visibility of IUOs and reduces the need of them I am for.
* Does this proposal fit well with the feel and direction of Swift?This
fits with Swift 3s simplification of the APIs * If you have you used other
languages or libraries with a similar feature, how do you feel that this
proposal compares to those?I don't have any experience in other languages.
* How much effort did you put into your review? A glance, a quick reading, or
an in-depth study?
In depth study.
More information about the Swift evolution process is available at
https://github.com/apple/swift-evolution/blob/master/process.md
Thank you,
-Chris Lattner
Review Manager
_______________________________________________
swift-evolution-announce mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution-announce
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution