getSymbolsByUDA in constructor/member functions

frame frame86 at live.com
Thu Jun 16 08:55:09 UTC 2022


On Thursday, 16 June 2022 at 08:23:20 UTC, Arafel wrote:

> As you can see, it's `getMember` who is returning a reference 
> to the `this` instance. In my view, this is a bug according the 
> documentation and examples [1]. It might be that classes behave 
> differently, but then it should be documented.

>
> In fact, it shouldn't work at all and you'd need to instantiate 
> Def: `getMember` should fail because `x` and `y` are not static.

This is not true. `getMember` can return the symbol to the 
instance or the type/alias, depending if you pass `this` or 
`Def`. The last is static.

It makes no sense to use the attribute from a class without an 
instance.




More information about the Digitalmars-d-learn mailing list