proposed @noreturn attribute

Marco Leise via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 10 16:27:32 PDT 2017


Am Sat, 8 Jul 2017 03:15:39 -0700
schrieb Walter Bright <newshound2 at digitalmars.com>:

> […]
>
> Having an @noreturn attribute will take care of that:
> 
>     @noreturn void ThisFunctionExits();
> 
> Yes, it's another builtin attribute and attributes are arguably a failure in 
> language design.

The 'none' return type sounds interesting, because a @noreturn
function is also a void function, it is practical to implement
this as a void sub-type or compiler recognized druntime
defined "type intrinsic". On the other hand, the attribute
solution has worked well for the existing compilers in practice
and such a rarely used tag doesn't add significantly to the
meticulous D programmers list: "pure @safe nothrow @nogc".

-- 
Marco



More information about the Digitalmars-d mailing list