[swift-evolution] [Draft] Change @noreturn to unconstructible return type

Антон Жилин antonyzhilin at gmail.com
Sun Jun 5 18:30:23 CDT 2016

Bringing up an old idea, we could rewrite `rethrows` using Never and throws
type specification:

func call<T, E>(block: () throws E -> T) throws E -> T

But this requires some compiler magic: non-throwing functions should
effectively become functions throwing Never.

- Anton

2016-06-06 1:53 GMT+03:00 Charles Srstka <cocoadev at charlessoft.com>:

> On Jun 5, 2016, at 5:41 PM, Michael Peternell via swift-evolution <
> swift-evolution at swift.org> wrote:
> Am 05.06.2016 um 20:26 schrieb Антон Жилин via swift-evolution <
> swift-evolution at swift.org>:
> 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 like to call the type `Void`. `Void` is a type with zero possible
> values. The current `Void` would have to be renamed to `Unit`, the data
> type with exactly one possible value. Less C, More Haskell :) But wait,
> that's not really Haskell-ish, and it's not C-ish either.
> That is the most confusing possible thing that this could possibly be
> called. Seeing a Void return will cause anyone coming from a C, C++, ObjC,
> etc. background to think of something that is definitely *not* a no-return
> function.
> Charles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160606/e8c7c203/attachment.html>

More information about the swift-evolution mailing list