Reimplementing the bulk of std.meta iteratively

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


On 10/8/20 7:06 AM, Stefan Koch wrote:
> On Thursday, 8 October 2020 at 09:51:15 UTC, Atila Neves wrote:
>>
>> 1. This is awesome.
>> 2. I agree with everything said about keeping the core language simple 
>> and lowering to fundamental constructs. I agree with that in general, 
>> and it's a lot easier to agree with it in the context of D given that 
>> it's a large language already.
>>
>> Lisp got mentioned in this thread as if it's some kind of failure, and 
>> for the life for me I have no idea why.
>>
>> Users: dmd has too many bugs!
>> Also users: please add my bugs, err, feature!
> 
> ---
> alias MostDerived(Args...) = dereify!({
>>     auto ids = reify!Args;
>>     sort!((a, b) => is(dereify!a : dereify!b))(ids);
>>     return ids;
>> }());
> ---
> 
> Note that the example I re-posted above doesn't actually work.
> Because of polymorphism.

The following works:

alias DerivedToFront(Args...) = dereify!({
     auto ids = reifyArray!Args;
     ids.sort;
     return ids;
}());

https://gist.github.com/andralex/0d85df38be2d9ffbe89cf1fb51c44213


More information about the Digitalmars-d mailing list