Is there a way to get the name of the current function?

JG someone at simewhere.com
Tue Mar 7 22:19:22 UTC 2023


On Tuesday, 7 March 2023 at 22:11:49 UTC, rempas wrote:
> For example, in the given code:
>
> ```d
> void my_function() {
>   import std.stdio;
>
>   writeln("The name of the function is: ", 
> <fn_name_macro_or_something>);
> }
> ```
>
> Is there something to put in the place of 
> `<fn_name_macro_or_something>` to get the name of the function?

Yes, see here: 
https://dlang.org/spec/expression.html#specialkeywords


More information about the Digitalmars-d-learn mailing list