www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Get name of alias parameter at compile time?

reply dsimcha <dsimcha yahoo.com> writes:
Is there a way to get the name of an alias parameter at compile time?  For
example:

void doStuff() {
    // Do stuff.
}

void templ(alias fun)() {
   writeln(fun.stringof);  // Prints doStuff.
}
Oct 13 2009
parent Jacob Carlborg <doob me.com> writes:
On 10/14/09 06:36, dsimcha wrote:
 Is there a way to get the name of an alias parameter at compile time?  For
 example:

 void doStuff() {
      // Do stuff.
 }

 void templ(alias fun)() {
     writeln(fun.stringof);  // Prints doStuff.
 }

Do you want that to print "fun" instead of "doStuff"?
Oct 14 2009