How to get instance member value from getSymbolsByUDA

max haughton maxhaton at gmail.com
Sat Feb 26 18:33:59 UTC 2022


On Saturday, 26 February 2022 at 17:06:06 UTC, Remi Thebault 
wrote:
> On Saturday, 26 February 2022 at 12:01:14 UTC, max haughton 
> wrote:
>>
>> Getting the UDAs from inside a symbol must be done via a 
>> recursive procedure in the same manner one would identify the 
>> aforementioned symbol i.e. you have to go through the fields 
>> looking for UDAs *then* use getUDAs.
>>
>> This is because UDAs cannot convey information without their 
>> context, so the trait doesn't look recursively.
>
> I don't need to get access to the UDA value, I need the value 
> of the field decorated with UDA.
> Finally I can get access to the member using 
> `__traits(getMember, req, paramSymbols[0].stringof)`.

I see, my apologies. FYI if possible you should avoid using 
stringof because it's basically only intended for debugging so 
isn't always consistent - this is what __traits(identifier) is for


More information about the Digitalmars-d-learn mailing list