bottom type as parameter or local variable, does that make sense?

Timon Gehr timon.gehr at gmx.ch
Fri Jan 14 18:24:22 UTC 2022


On 1/14/22 18:41, H. S. Teoh wrote:
> But in D, whenever a variable is declared, it gets initialized to its
> default value unless specified otherwise. Since nothing is specified
> here, it ought to perform its default initialization, and since there is
> no value with which it can be initialized, it ought to raise a runtime
> exception.

I don't follow why this is necessarily desirable. E.g., if generic code 
checks whether or not a type can be default constructed, it will by 
default get a spurious "yes" answer and has to special case `noreturn`.


More information about the Digitalmars-d mailing list