DIP 1017--Add Bottom Type--Final Review

Nicholas Wilson iamthewilsonator at hotmail.com
Wed Jan 16 05:20:31 UTC 2019


On Wednesday, 16 January 2019 at 04:52:15 UTC, aliak wrote:
> On Wednesday, 16 January 2019 at 04:33:08 UTC, Nicholas Wilson
>> 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.
>
> You'd have to take that in to consideration because you'd have 
> to implement the logic to handle it though no?

No, the logic to handle it is already there `typeof(f()) == int`, 
just if you call it, it is undefined behaviour for it to return.

> And I guess I just disagree with not taking how people would 
> write code in to consideration.

I agree with the sentiment, but people are not going to write 
code like that. People can write a spaghetti of gotos, do they? 
Of course not. Should we designing around the fact that they can?

> A proper type gives you everything the attribute does, and has 
> the advantage of not allowing for weird code, and makes the 
> type system more solid, and provides future top-type 
> possibilities. It sounds like the only argument for an 
> attribute is "it's a bit quicker to implement" ... in which 
> case I'd not vote for it.

Solidification of the type comes at the cost of complexity, time, 
learning curve and bunch of other things. If the only advantage 
of type over an attribute is that it disallows code that people 
are not going to write in the first place, then the benefits its 
provides are not _practical benefits_ and we should treat them as 
such in the cost benefit analysis.

The fact that it is already implemented is icing on the cake (or 
nail in the coffin, depending in which way you look at it).


More information about the Digitalmars-d mailing list