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 00:07:25 UTC 2021


I know the answer for this will be a resoundingly no, but, anyway 
...

I have, more-or-less, the following function:

```d
public void debugwriteln(typeValue)(
    const dstring lstrTag,
    const typeValue lstrValue
    ) {

    writeln(console.colorizeYellow(r"debugging"d), r" → "d,
       lstrTag,
       r"=["d,
       lstrValue,
       r"]"d
       );

} /// console.colorizeYellow() does the obvious thing on the 
terminal
```

... which I oftenly use as following to highlight what I am doing 
at any given time:

```d
void main() {

    ...

    debugwriteln(r"lobjExchanges.count"d, lobjExchanges.count);

    foreach (typeExchange lobjExchange; lobjExchanges) {

       debugwriteln(r"lobjExchange.toString()"d, 
lobjExchange.toString());

    ...

    }

}
```

... with typical output as following:

debugging → lobjExchanges.count=[2]
debugging → lobjExchange.toString()=[NYSE (New York Stock 
Exchange) @ New York, USA on EST]
debugging → lobjExchange.toString()=[NASDAQ (National Association 
of Securities Dealers Automated Quotations) @ New York, USA on 
EST]

Every time I use it, of course, I have to double-type the tag and 
the value. I wonder if there's some mechanism to just type the 
following:

```d
debugwriteln(lobjExchanges.count);
```

... and some way to get the identifier of what's being passed, he.


More information about the Digitalmars-d-learn mailing list