"I told you so": noreturn sucks a leech and has virtually no utility

Timon Gehr timon.gehr at gmx.ch
Fri Oct 15 22:15:35 UTC 2021

On 10/15/21 11:48 PM, H. S. Teoh wrote:
> On Fri, Oct 15, 2021 at 01:13:29PM -0400, Andrei Alexandrescu via Digitalmars-d wrote:
>> It has been predicted by several folks that noreturn has very limited
>> utility and a variety of weird corner cases that will cause a hecatomb
>> of complications in the language, the standard library, and the
>> implementation.
> Besides its weird name (it's really a bottom type than anything else;
> calling it noreturn is somewhat misleading), what exactly is wrong with
> it?
> T

- What's in DMD is an incomplete implementation of DIP 1034, often 
resulting in ICEs.
- It gives more static information to the compiler, exacerbating the 
issue of dead code warnings in generic code.
- Existing template constraints sometimes don't deal with the new type 
- It implicitly converts to everything, so you can have ambiguous 

void foo(int x){ }
void foo(string x){ }

void main(){ foo(assert(0)); }

I suspect that's ultimately the underlying issue why 
isInputRange!(noreturn[]) was false. (noreturn[] was treated as an 
autodecodable string due to some questionable design decisions in 
Phobos, but then it was not clear which overload of `decode` to use. Is 
`noreturn[]` encoded in utf-8 or utf-16? The answer is both.)

More information about the Digitalmars-d mailing list