Reimplementing the bulk of std.meta iteratively

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Oct 1 01:49:02 UTC 2020


On 9/30/20 7:36 PM, H. S. Teoh wrote:
> I think there's a lot of value to be had in making typeid(T) as the
> reification of T.  At compile-time, we treat it specially by augmenting
> it with the ability to do things that can only be done at compile-time,
> such as recover T given typeid(T) (pass it into a template parameter,
> construct new types out of it, etc.). At runtime, it reverts to the
> current behaviour of typeid(T).
> 
> Only trouble is, according to Andrei, typeid has been written over so
> many times that even Walter doesn't understand how it works anymore.
> Meaning there are probably weird corner cases and quirky behaviours that
> we may not want to duplicate at compile-time. So I dunno, this seems
> like a roadblock to further progress.

Yah, that would be my favorite by far. It's a one-liner change in the 
definition of the language. "Since version x.xx, the result of typeid() 
is usable during compilation." It's also the best /kind/ of change to 
the language, i.e. lifts a gratuitous restriction that prevents 
composition of distinct features (here, ctfe and typeid).

A promising path according to Walter is to develop a parallel enhanced 
feature - newtypeid! :o) - and then deprecate typeid.


More information about the Digitalmars-d mailing list