proposed @noreturn attribute
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jul 9 07:10:01 PDT 2017
On 7/9/17 9:16 AM, Andrei Alexandrescu wrote:
> I wonder why there's so much attraction to exotic approaches when
> encoding "no return" with types has so much established theory and
> practice with it. -- Andrei
>
Your definition of exotic differs from mine.
I haven't seen another solution other than out { assert(0); } which
semantically means "this function cannot return" in the current
compiler, and pretty much all historical D compilers, is obvious to the
reader that it does so, available in the prototype, and is there and
ready for the compiler to optimize with. Literally we have to change
nothing in the language or library, only how the optimizer handles it.
Adding specialized attributes, esoteric types, etc, does not have this
same level of compatibility. That is why I find this more attractive
than any other suggestions so far.
-Steve
More information about the Digitalmars-d
mailing list