Getting symbol of current function?

Stefan Koch uplink.coder at googlemail.com
Fri Dec 7 14:56:22 UTC 2018


On Friday, 7 December 2018 at 10:51:38 UTC, Tomer Filiba wrote:
> Is there some clever way to get the *symbol* of the current 
> function, given overloads? I want to log the current function's 
> arguments, but __FUNCTION__ et al only give me a name, which 
> resolves to the first overload. For instance,
>
>     void f(int x) {
>         pragma(msg, "overload1", 
> Parameters!(mixin(__FUNCTION__)));
>     }
>     void f(int x, int y) {
>         pragma(msg, "overload2", 
> Parameters!(mixin(__FUNCTION__)));
>     }
>
> shows
>     overload1(int)
>     overload2(int)
>
> It would be awesome to have something like __FUNCTION_SYM__ or 
> so, which references the actual symbol.
>
> -tomer

It'd be awesome to have symbol variables in general.

I am currently looking into that :)


More information about the Digitalmars-d mailing list