The NaN of types (in D)

Paul Backus snarwin at gmail.com
Sun Oct 11 17:18:20 UTC 2020


On Sunday, 11 October 2020 at 15:23:45 UTC, Stefan Koch wrote:
>
> __type need an init value otherwise phobos breaks all over the 
> place.
> and it's much nicer if that value is not part of the domain.

By definition, the init value of a type is part of that type's 
domain. What adding ø does is extend the domain of __type from 
"all types" to "all types, plus one additional value that isn't a 
type." Thus the comparison to Optional, which does the same thing.

Both __type and Optional!__type are useful and worth having, but 
I think it would be better to keep them separate than to make all 
__type variables implicitly nullable. Optional!__type's init 
value can be "not a type", and __type's init value can be bottom.


More information about the Digitalmars-d mailing list