On 11/02/2012 10:34 PM, Philippe Sigaud wrote:
By changing this to a standard function:
const(char[]) __FUNCTION() @property
{
return "__traits(identifier, __traits(parent, {}))";
}
... the calling syntax is slightly easier on the eye:
void main()
{
writefln( "File: %s, Func: %s, Line: %d", __FILE__,
mixin(__FUNCTION), __LINE__ );
//throw new Exception( "Error: Function " ~ mixin(__FUNCTION) );
}
That is, mixin(__FUNCTION) instead of mixin(__FUNCTION!())
Is there any downside to this?
I'd make it
enum currentFunction = q{ __traits(identifier, __traits(parent, {})) };