> On Jun 5, 2016, at 1:49 PM, Pyry Jahkola via swift-evolution > <swift-evolution@swift.org> wrote: > > >> On 05 Jun 2016, at 21:26, Антон Жилин via swift-evolution >> <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> 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
I dunno, I think @noreturn is clearer than any of these. It tells you that the function… won’t return. None, Never, etc. could be mistaken as a synonym for Void, whereas @noreturn is pretty hard to miss. Charles
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution