On Wednesday, 15 June 2022 at 12:26:40 UTC, cc wrote:
Why doesn't this work? There is nothing in the foreach body.
```d
alias ALL = getSymbolsByUDA!(Def, XML);
pragma(msg, ALL.stringof);
```
reports `tuple(this.x, this.y)`. Why is `this.` added?
I can only answer this partially, I guess `this` is just added
because `getSymbolsByUDA` want an instance but `@XML` is only
seen as a type. As instance, you need to write `@XML()` instead:
```d
class XML {
static opCall() {
return new XML();
}
}
class Def {
@XML() {
int x;
int y;
}
int z;
this() {
static foreach (sym; getSymbolsByUDA!(Def, XML)) {
}
}
}
```