On Friday, 7 December 2018 at 02:37:34 UTC, Arun Chandrasekaran
wrote:
I'm trying to get the current function name and apparently the
commented line errors out.
What am I doing wrong?
https://run.dlang.io/is/EGsRU2
```
#!/usr/bin/rdmd
void main()
{
import std.experimental.all;
void foo() {
// __traits(identifier, mixin(__FUNCTION__)).writeln;
// compilation error
__FUNCTION__.split('.')[$-1].writeln;
}
__traits(identifier, mixin(__FUNCTION__)).writeln;
__FUNCTION__.split('.')[$-1].writeln;
foo();
}
```
Looks like this will do the trick https://run.dlang.io/is/cX3S37