How to get instance member value from getSymbolsByUDA

max haughton maxhaton at
Sat Feb 26 12:01:14 UTC 2022

On Saturday, 26 February 2022 at 11:38:16 UTC, Remi Thebault 
> On Saturday, 26 February 2022 at 11:26:54 UTC, max haughton 
> wrote:
>> On Saturday, 26 February 2022 at 10:39:18 UTC, Remi Thebault 
>> wrote:
>>> Hi all,
>>> I'm trying to establish a REST API by using the type system 
>>> (used in both client and server code).
>>> [...]
> How do I use `getUDAs` in this context?
> I have `getUDAs!(req, Param).length == 0`. I think it only 
> works on the struct attributes, not on the fields attributes.

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.

More information about the Digitalmars-d-learn mailing list