DIP 1017--Add Bottom Type--Final Review

Nicholas Wilson iamthewilsonator at hotmail.com
Wed Jan 16 04:33:08 UTC 2019


On Wednesday, 16 January 2019 at 04:24:34 UTC, aliak wrote:
> On Wednesday, 16 January 2019 at 01:14:58 UTC, Nicholas Wilson 
> wrote:
>> Those can all be done by an attribute. So it comes down to a 
>> cost benefit analysis: the benefits they provide are the same, 
>> except the implementation of bottom is going to be much more 
>> costly.
>
> Is it "much" more costly?

Bottom, must be implemented in the compiler. Attributes exist 
_now_.

version (LDC)
     enum noreturn = ldc.attributes.llvmAttr("noreturn"));
else version (GDC)
     enum noreturn = gcc.attribute.attribute("noreturn"); // ?
else version (DigitalMars)
     enum noreturn;

This exhibits the documentation benefits on all compilers, and 
performance gains on the compilers that matter.

> What about the benefit of not being able to write code like:
>
> @noreturn int f() { ... } // wat?

Yes that is possible. Does it make sense to write? Of course not. 
We shouldn't be taking into considerations of people writing code 
like that when designing the language. `@noreturn void` is what 
people use in C/C++ I don't see why that wouldn't follow in D.



More information about the Digitalmars-d mailing list