The NaN of types (in D)

Stefan Koch uplink.coder at googlemail.com
Sun Oct 11 18:09:28 UTC 2020


On Sunday, 11 October 2020 at 17:18:20 UTC, Paul Backus wrote:
> 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.

Instantiating a template for just one more additional value?
Having to drag this bool around in ctfe?
Having to check it every time when you do an is-exp?

that's crazy.
Especially when I have to choice to define an empty type.



More information about the Digitalmars-d mailing list