Dealing with raw types as attributes

Ali Çehreli acehreli at yahoo.com
Thu Nov 1 18:35:27 UTC 2018


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

Ali


More information about the Digitalmars-d-learn mailing list