Adam D. Ruppe:
> How about this?

If the sequence of functions is known at compile-time your solution can be 
used, thank you.
I have changed your function a little so it keeps the same order (in a hash 
iteration order is arbitrary):

auto funcWithName(T...)() {
    Tuple!(string, typeof(&T[0]))[] result;
    foreach (t; T)
        result ~= tuple(__traits(identifier, t), &t);
    return result;
}


> import std.traits;

Why do you import std.traits?


> Btw, do we still need classinfo now that we have __traits?

I think __traits is (mostly) for compile-time, while classinfo is run-time.
(Surely there are ways to design a tidier compile-time and run-time reflection 
API).

Bye,
bearophile

Reply via email to