Reimplementing the bulk of std.meta iteratively

Bruce Carneal bcarneal at gmail.com
Thu Oct 1 04:16:52 UTC 2020


On Thursday, 1 October 2020 at 01:49:02 UTC, Andrei Alexandrescu 
wrote:
> 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.

Glad to see that you're open to changing the language in order to 
achieve better power/complexity ratio.  Right there with you on 
that sentiment!

Two questions:

1) How many additional additions do you estimate you'll need for 
this? and

2) How do the type function addition(s) compare?  Are they also 
of the "best kind of change" variety?






More information about the Digitalmars-d mailing list