On Thu, 01 Nov 2018 11:35:27 -0700, Ali Çehreli wrote: > On 11/01/2018 09:14 AM, Neia Neutuladh wrote: >> The spec says that a user-defined attribute must be an expression, but >> DMD accepts a wide range of things as UDAs: >> >> struct Foo { string name = "unknown"; } >> @Foo int bar; >> >> `bar` has the *type* Foo as an attribute. It's not an *instance* of >> Foo. So if I try to look at the UDAs: > > That would work with hasUDA(). I have an example here: > > http://ddili.org/ders/d.en/uda.html
That lets me test for presence, nothing more. While that's useful, I usually have a UDA struct whose fields I need to access. std.traits.getUDAs doesn't hide the difference between @Foo and @Foo(), so that's also not an option. I could use a customized version of that that replaces @Type with @Type.init, and that's a reasonable choice when I know other people aren't going to deal with that annotation type.