> On 05 Jun 2016, at 21:26, Антон Жилин via swift-evolution
> <[email protected]> wrote:
>
> The following names were suggested: NoReturn, Bottom, None, Never.
> I would pick None, because it looks like opposite to Any and fits nicely in
> generic types.
I would pick `Never` because `None` would overload the notion of a returnable
nothingness with its antonym!
OTOH, "never" is quite unlikely to be a type name in user code, likely pretty
googleable, and explains itself quite well in examples like `Result<Value,
Never>`.
> 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.
I think it would be more useful if the compiler allowed `Never` in every type
context (i.e. whatever type `T` was expected, an expression of type `Never`
would be allowed), making expressions like the following compile:
let unwrapped: Int = optional ?? fatalError("explanation why this must not
happen")
— Pyry
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution