Custom attributes (again)

Piotr Szturmaj bncrbme at jadamspam.pl
Fri Apr 6 03:59:24 PDT 2012


Walter Bright wrote:
> Are you really changing the arguments for every declaration? Or is it
> one set that is repeated everywhere?

The former.

>> I don't see the advantage over:
>> @editor(...)
>>
>> ?
>
> Name collisions with other @ attributes.

The same applies to other identifiers, like class named "class". NET has 
predefined attributes too, but they use the same syntax as the custom ones:

[MyAttr(5)] int x;

I think @MyAttr(5) declaration looks more readable than 
@attr(MyAttr(5)). To avoid name clashes, in case of using builtin name, 
qualified identifier should be used:

@myModule.pure
@pure
void fn() {}


More information about the Digitalmars-d mailing list