static map as a type function

Stefan Koch uplink.coder at
Thu Sep 24 06:49:25 UTC 2020

On Thursday, 24 September 2020 at 05:13:49 UTC, Andrei 
Alexandrescu wrote:
> * Currently mixin closes the circle by taking back the typeid 
> to the type it started from. It would be nice to have something 
> better, e.g. t.Type would just be the type.

This would make typeid polymorphic in other words a template.

> * In the current implementation values returned by typeid() 
> cannot be read during compilation.

Wrong. parts of typeid can be read by ctfe.
I extended this functionality myself.

> So one question is if they could. Per 
>, that can be done 
> largely at the library level.

Perhaps but I don't see how to do that without introducing 
polymorphic types (meaning template types)

> * This could work with no change to the language definition. 
> All that's needed to get lift is make TypeInfo values usable 
> during compilation.

Wrong. The polymorphic nature you need to get back to the type 
from typeid
would be a massive change.

More information about the Digitalmars-d mailing list