"I told you so": noreturn sucks a leech and has virtually no utility
Paul Backus
snarwin at gmail.com
Sat Oct 16 13:40:23 UTC 2021
On Saturday, 16 October 2021 at 05:27:42 UTC, Ola Fosheim Grøstad
wrote:
> On Friday, 15 October 2021 at 19:10:42 UTC, Stefan Koch wrote:
>> Seconded. The point of noreturn is precisely to reject less.
>> The no-return type has no values which means reading or
>> writing that type is merely undefined behavior. It doesn't
>> have to be rejected.
>
> If we ignore the DIP, couldn't you just as well claim that you
> should be able to assume anything about a type that is never
> instantiated as long as the assumption does not lead to a
> contradiction?
Even if you, the programmer, could make such assumptions, the
compiler cannot, because proving that a type is never
instantiated is halting-equivalent.
`noreturn`, on the other hand, is defined in the language spec to
be impossible to instantiate, so the compiler does not need to
prove anything.
More information about the Digitalmars-d
mailing list