core.reflect vs c++ reflection

Per Nordlöw per.nordlow at gmail.com
Tue Sep 28 12:38:52 UTC 2021


On Tuesday, 28 September 2021 at 12:32:04 UTC, Per Nordlöw wrote:
>> .stringof should never be used outside of debugging messages.
>
> Why? And in what cases is`.stringof` worse than 
> `__traits(identifier)`?

Note that `.stringof` works in cases where `__traits(identifier)` 
doesn't, such as in

```d
alias S = string;
pragma(msg, S.stringof); // ok, print `string`
pragma(msg, __traits(identifier, S)); // fails
```

.


More information about the Digitalmars-d mailing list