[swift-evolution] [Review] SE-0054: Abolish ImplicitlyUnwrappedOptional type
davesweeris at mac.com
davesweeris at mac.com
Fri Mar 25 15:42:27 CDT 2016
I’m pretty sure I only use them with `@IBOutlet` vars.
One of the alternatives list is:
• Remove IUOs completely. Untenable due to the prevalence of deferred initialization and unannotated Objective-C API in today's Swift ecosystem.
What about leaving IUOs in the compiler, but disallowing them unless the code is marked @objc (and treating them as `T?` in code that isn’t)? The stated motivation is "This proposal seeks to limit the adoption of IUOs to places where they are actually required, and put the Swift language on the path to removing implicitly unwrapped optionals from the system entirely when other technologies render them unnecessary.”… If they’re only intended to be used with C/Obj-C code, seems like that’s something that’d be possible for the compiler to enforce.
Having typed this all out, I’m starting to suspect it might be more complicated than what we have now… Hmm… I’ll hit send anyway, in case I’m wrong.
- Dave Sweeris
> On Mar 25, 2016, at 3:10 PM, Joseph Lord via swift-evolution <swift-evolution at swift.org> wrote:
> On 25/03/2016 15:24, Chris Lattner via swift-evolution wrote:
>> Hello Swift community,
>> The review of "Abolish ImplicitlyUnwrappedOptional type" begins now and runs through March 30th. The proposal is available here:
> As I don't use IUO optionals I'm really fairly neutral on the proposal. I just wanted to mention with the powerful tools we have for dealing with optionals (optional, chaining, nil-coalescing, map, flatmap, guard, and let - thanks Chris and team) it really would be quite feasible to do away with IUOs completely. I don't think the community is ready for that yet so I'm not proposing that course of action at this time but such a proposal wouldn't get a universally hostile response.
> Even force unwrap is something that I only do test code since flatmap was added to the Standard Library (I used to have my own implementation of flatmap with a force unwrap after a filter which was the only production use I've put force unwrap to).
> swift-evolution mailing list
> swift-evolution at swift.org
More information about the swift-evolution