pragma msg field name?
Chris Katko
ckatko at gmail.com
Tue Jun 27 04:25:13 UTC 2023
inside a static foreach I can do
```
enum rep;
class myObject{
int field1, field2, field3;
static foreach(field; getSymbolsByUDA!(typeof(this), rep))
{
pragma(msg, field); // fails
pragma(msg, fullyQualifiedName!field); // works
}
}
```
error for pragma(msg, field)
```
source/app.d(33,16): Error: value of `this` is not known at
compile time
source/app.d(33,4): while evaluating `pragma(msg, field)`
[repeating for every variable in the class]
```
How do I get just the field name? And why does it think this is a
run-time value? I need to wrap it in some sort of template?
All I see in std.traits docs are: fullyQualifiedName mangledName
moduleName packageName
More information about the Digitalmars-d-learn
mailing list