static map as a type function

Andrei Alexandrescu SeeWebsiteForEmail at
Thu Sep 24 14:03:32 UTC 2020

On 9/24/20 8:58 AM, Steven Schveighoffer wrote:
> On 9/24/20 6:12 AM, Timon Gehr wrote:
>> On 24.09.20 07:13, Andrei Alexandrescu wrote:
>>> A few comments:
>>> * 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.
> Hm... so I'm guessing TypeInfo.Type or __traits(typeFromId) would only 
> work for CTFE?

Affirmative - wouldn't make sense otherwise as you could create (or 
receive) such an object dynamically.

> That sounds interesting. Could be a different way to implement type 
> functions, without requiring a new mechanism of passing type data. And 
> there is the potential (I think) of making functions that are only type 
> functions for CTFE, and can do something different if used at runtime 
> (via __ctfe).


One nice thing it would do is unify CTTI with RTTI. There's a lot of 
unused potential in the run-time use of TypeInfo that I'll discuss at a 
later time.

More information about the Digitalmars-d mailing list