October 16, 2021 Re: "I told you so": noreturn sucks a leech and has virtually no utility | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paul Backus | 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. |
Copyright © 1999-2021 by the D Language Foundation