The NaN of types (in D)

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Mon Oct 12 15:44:44 UTC 2020


On Monday, 12 October 2020 at 15:10:55 UTC, Stefan Koch wrote:
> ø.sizeof == 0.
> For it's members
> __traits(allMembers, ø) == []
> ....
> And I think that's all of the introspection I currently support.
>
> __traits(getAttributes) is currently not available anymore as I 
> need to define, a type which can hold anything  (and not just 
> types) for that to work.

I think you need to ask yourself why you need this?
You can also look at how other languages do type variables.

One clean solution is to bind them to Object and subclasses of 
Object, but since Object is not a subtype of all D types you 
could use __bottom__. I don't really see a good argument for why 
__bottom__ cannot be used?  You cannot instantiate __bottom__.

If you went for something more generic like AST-node pointers 
then it would make sense, but then you could just go with null... 
basically representing "is waiting for a value" or "under 
construction".

But then you also need to figure out if you want to represent 
incomplete types.



More information about the Digitalmars-d mailing list