bottom type as parameter or local variable, does that make sense?
maxsamukha at gmail.com
Sat Jan 15 16:34:55 UTC 2022
On Saturday, 15 January 2022 at 14:43:14 UTC, Paul Backus wrote:
> Making initialization of `noreturn` fail at runtime would
> require *two* special cases: first, the special case of
> `noreturn` having no values when every other type in D has at
> least one value;
noreturn is no more special than 0 number or empty set. They are
special cases of the right kind. Divide by zero fails at runtime,
but removing 0 because of that would be a bad idea.
> and second, the special case of `noreturn`'s default
> initializer not evaluating to a `noreturn` value when every
> other type's default initializer evaluates to a value of that
I think noreturn.init can be viewed as a value of noreturn.
> There is an argument to be made that we should never have
> accepted special case #1 in the first place (i.e., that the
> `noreturn` DIP should have been rejected). But given that we
> have, I think it is better to accept the consequences that
> follow from that decision, strange though they may seem, than
> to introduce even more special cases to try and paper over them.
I am not convinced that your special case is better than mine. )
More information about the Digitalmars-d