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 03:51:17 UTC 2021


On Monday, 19 July 2021 at 03:05:24 UTC, Paul Backus wrote:
> On Monday, 19 July 2021 at 01:45:27 UTC, SealabJaster wrote:
>> On Monday, 19 July 2021 at 01:26:25 UTC, someone wrote:
>>> ...
>>
>> Not 100% sure this works in all cases, but this version 
>> doesn't need the caller to make use of a mixin: 
>> https://run.dlang.io/is/3jLxLz
>
> If you only need to print variables, not arbitrary expressions, 
> then this approach is much nicer.

Yes, just variables/properties.

> However, the mixin version is the only one that will work for 
> things like `debugWriteln!"x + y"`.

In this case a temp variable and I'm done.


More information about the Digitalmars-d-learn mailing list