__FUNC__ in D
Rob T
rob at ucora.com
Tue Sep 18 12:44:00 PDT 2012
> No.
The question is "Why not?". For a language that is supposed to
have good compile time relfection, and wants to have good runtime
relection, this basic inability illustrates an area in dire need
of attention.
I don't think a solution is to introduce __FUNC__, that will only
add on to the already big clutter pile. A more generalized
solution is to introduce self-referencing (and then get rid of
some of the clutter).
Eg
void function x()
{
writeln( typeof(self).stringof );
}
Even better, using the uniform calling syntax convention
void function x()
{
writeln( self.typeof.stringof );
}
--rt
More information about the Digitalmars-d-learn
mailing list