"I told you so": noreturn sucks a leech and has virtually no utility
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Sat Oct 16 13:59:23 UTC 2021
On Saturday, 16 October 2021 at 13:40:23 UTC, Paul Backus wrote:
> Even if you, the programmer, could make such assumptions, the
> compiler cannot, because proving that a type is never
> instantiated is halting-equivalent.
This would make sense if you made the claim "arbitrary type" and
"any possible program", but this is not what I meant.
> `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.
No, I meant, if you inject a "noreturn" type into generic code;
Then you know that it will never be instantiated and could allow
any assumptions about it to be true as long as the complete set
of "granted" assumptions does not lead to a contradiction.
More information about the Digitalmars-d