is there a way to get the identifier (call it name) of what is being passed to a function ?

someone someone at somewhere.com
Mon Jul 19 01:26:25 UTC 2021


On Monday, 19 July 2021 at 00:52:39 UTC, Paul Backus wrote:

> The closest you can get is to use a string mixin:
>
> ```d
> enum debugWriteln(string expression) =
>     `writeln(q"(` ~ expression ~ `)", " = ", ` ~ expression ~ 
> `);`;
>
> // Usage:
> mixin(debugWriteln!"lobjExchanges.count");
> ```

clever :)


More information about the Digitalmars-d-learn mailing list