Enough introspection to report variable name of calling argument
Handyman via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Oct 19 07:14:58 PDT 2015
Is the following possible in D? To call a (unary) function f
with variable a, and let f print:
> Called with argument named 'a'.
I am of course asking for a generic solution, independent of the
actual variable name (in this case, 'a'). I am aware that I am
likely asking the impossible because of how the function call
mechanism is implemented in most programming languages, hence in
D. Still, it might be possible given D's stong introspection
capabilities / traits / pragma's / whathaveyou's.
More information about the Digitalmars-d-learn
mailing list