proposed @noreturn attribute
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jul 18 19:42:48 PDT 2017
On 7/18/2017 7:14 PM, Nicholas Wilson wrote:
> It describe the behaviour of the function: I think it is neither necessary nor a
> good idea to express it as a type. assert(0) is already accepted as a valid
> return statement of any type.
I can't continue this without being repetitive, so we'll just have to disagree.
>> The backends for DMD, LDC and GDC would not be affected at all by the addition
>> of a bottom type to the front end, and it would be trivial for the glue code
>> to add the noreturn attribute for functions that return the bottom type.
>
> Said glue would be unnecessary with an attribute *that already exists*.
In the glue code, replace:
if (function attribute is 'noreturn')
set backend attribute to 'noreturn';
with:
if (function return type is 'bottom')
set backend attribute to 'noreturn';
set backend function return type to 'void';
and it should be ready to rock :-)
More information about the Digitalmars-d
mailing list