Is there a way to get the names of a function's parameters?

Adam Ruppe destructionator at gmail.com
Sun Jun 13 15:56:20 PDT 2010


Given:

void foo(int a, string b);

You can use std.traits.ParameterTypeTuple to get (int, string).

Is there any method, at all, to get ("a", "b") out of it? I can't find
one, and am considering import("mysrc.d"); and finding it that way,
but figured I'd ask first.

The benefits of getting the names would be runtime function calls, or
named arguments. Consider this:

ParameterTuple!foo args;

args.b = "hello";

foo(args);

That'd be kinda cool.


More information about the Digitalmars-d mailing list