Shouldn't __traits return Tuples instead of arrays (esp. allMembers) to allow sophisticated compile time reflection?
Currently it seems impossible to do something along the lines of

foreach (member; __traits (allMembers, Class))
{
    foreach (overload; __traits (getVirtualFunctions, Class, member))
    {
        // do stuff
    }
}

Maybe it would be possible with Tuples using template recursion.



Also the following doesn't work with dmd, returns 0 for all members:

Base base = new Base;
auto members = __traits(allMembers, typeof(base));
foreach(m; members)
    writefln(base.classinfo.getMembers(m).length);

Reply via email to