User Defined Attributes

Jacob Carlborg doob at me.com
Wed Nov 7 13:09:06 PST 2012


On 2012-11-07 21:38, deadalnix wrote:

>> Adding a whole new aggregate type is a pretty intrusive and major change.

Is it? Just have it behave as a struct or class. But I guess the 
suggestion below is just as good.

> So let's defined in object.d the following :
>
> @attribute struct attribute {}
>
> And then mark as @attribute anything that may used as attribute.
>
> @attribute struct foo {
>      string name;
> }
>
> @foo("asd") int a;
>
> If wasn't marked as @attribute, it wouldn't be an valid attribute.

I would be happy with this approach as well. But how much difference 
would it actually be to have:

attribute foo {
     string name;
}

-- 
/Jacob Carlborg


More information about the Digitalmars-d-announce mailing list