Function parameters UDAs

Radu void at null.pt
Wed Nov 14 16:28:19 UTC 2018


Looks like that there is no easy way to extract a function 
parameters UDA list.

The following:
```
import std.traits;

struct s { string foo; }
void foo(@s("aaa") int a, bool x);

void main()
{
     alias P = Parameters!foo;
     enum udas = __traits(getAttributes, P);
     pragma(msg, udas);
}
```
will print `tuple(s("aaa"))`

but if you change `foo` to `void foo(int a, @s("aaa") bool x);`

you get `Error: first argument is not a symbol`

Is this a current limitation or I'm using the wrong approach?


More information about the Digitalmars-d-learn mailing list