[swift-evolution] [Draft] Abolish IUO type
Brent Royal-Gordon
brent at architechies.com
Wed Mar 16 19:34:01 CDT 2016
> The most significant one is that I think that describing this in terms of an IUO attribute (which is an internal implementation detail) makes the proposal more confusing than necessary for the non-compiler hackers. :-)
For what it's worth, I actually find it really helpful to have a way to talk about these kinds of features without sugar. I spent most of this proposal going "So, does that mean `Int!` is now `@implicitly_unwrapped Optional<Int>`?"
It's particularly important in this case because `!` implies `?`; there's a lot of magic going on here. Without a completely unambiguous way to write about this behavior, it's hard to talk about it precisely.
For instance, I have two questions for the proposal's author:
* Would the declaration `Int?!` mean `@implicitly_unwrapped Optional<Int>` or `@implicitly_unwrapped Optional<Optional<Int>>`?
* You say that things like `[Int!]` and `(Int!, Int!)` (`Array<@implicitly_unwrapped Optional<Int>>` and `(@implicitly_unwrapped Optional<Int>, @implicitly_unwrapped Optional<Int>)`) are illegal; are `Int!?` and `Int!!` (`Optional<@implicitly_unwrapped Optional<Int>>` and `@implicitly_unwrapped Optional<@implicitly_unwrapped Optional<Int>>`) illegal as well? (Actually, having written this out explicitly, I'm now fairly confident of the answer: yes, they are illegal.)
These kinds of questions are hard to pose unless we have a language to discuss them in, even if that language is rarely actually used when we write code.
--
Brent Royal-Gordon
Architechies
More information about the swift-evolution
mailing list