Reimplementing the bulk of std.meta iteratively

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Oct 8 13:12:22 UTC 2020


On 10/8/20 8:16 AM, Stefan Koch wrote:
> On Thursday, 8 October 2020 at 12:05:22 UTC, Andrei Alexandrescu wrote:
>>
>>
>> The following works:
>>
>> alias DerivedToFront(Args...) = dereify!({
>>     auto ids = reifyArray!Args;
>>     ids.sort;
>>     return ids;
>> }());
>>
>> https://gist.github.com/andralex/0d85df38be2d9ffbe89cf1fb51c44213
> 
> Only with the ID struct that defines the op-compare.
> Which is significantly more complicated that the custom sort predicate.
> And also more inflexible.

Less flexible during compilation, more flexible at runtime. It is quite 
satisfying that the same information in reified form (strings I think in 
that gist) is equally usable during compilation, at run-time, or in 
mixed scenarios (Variant).

I wonder what other information would be useful to persist through 
runtime aside from the trivial (size, alignment) and the more involved 
(enough information to decide conversions). For functions, I assume that 
would be the returned type and the parameter types along with all 
adornments (ref, out, all that stuff). For classes, interfaces, and 
structs, that would include all public methods - probably on demand by 
means of an @rtti attribute so as to not waste time and space.


More information about the Digitalmars-d mailing list