[swift-evolution] [Draft] Change @noreturn to unconstructible return type
antonyzhilin at gmail.com
Sun Jun 5 13:26:47 CDT 2016
The following names were suggested: NoReturn, Bottom, None, Never.
I would pick None, because it looks like opposite to Any and fits nicely in
I would prefer the type to be simple, and be implemented as a case-less
enum (not a bottom value, as in Haskell).
None should be a usual enum, with no compiler magic except that functions
returning None are equivalent to current @noreturn.
let x: None?
let y = x!
It will trap in runtime not because we discover scary bottom thing, as in
Haskell, but because x had value Optional.none at that moment and we
We could prove that it is always true in this case, but compiler must be
stupid about this.
Compiler should allow including None in structures. Error will show up in
constructor, when we will not be able to initialize the field.
None in an enum case makes that case never appear in values of such a type.
But compiler can not know about that.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution