The NaN of types (in D)
Paul Backus
snarwin at gmail.com
Sun Oct 11 15:19:17 UTC 2020
On Sunday, 11 October 2020 at 12:18:59 UTC, Stefan Koch wrote:
> So we need a type that behaves just like Terror (i.e. is not
> considered a type by the is expression) but is not an error.
>
> This type is the empty type (Ø).
> It is emptier than void and on the same level as bottom (⊥).
> But Ø cannot be ⊥, because ⊥ can be a valid return type of a
> function.
> (At least once we have the ⊥ type)
>
> Ø not being a valid type as far as the is expression is
> concerned.
> (is(Ø) yields false)
> Also means that is(Ø == Ø) also yields false.
To me, this sounds more like an empty Optional!__type or a null
__type* than a NaN. Maybe it would be better to leave __type as
the non-nullable version, and use something like __type* to
represent a type that may be absent.
More information about the Digitalmars-d
mailing list