DIP64: Attribute Cleanup

Brad Anderson via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 20 12:45:45 PDT 2014


On Friday, 20 June 2014 at 19:22:04 UTC, Brian Schott wrote:
> http://wiki.dlang.org/DIP64
>
> Attributes in D have two problems:
> 1. There are too many of them and declarations are getting too 
> verbose
> 2. New attributes use @ and the old ones do not.
>
> I've created a DIP to address these issues.

I like it.

Just thinking aloud, it could be interesting to allow compile 
time logic of some sort (both on the arguments and on the symbol 
the attribute is being attached to).

Contrived example borrowing template syntax (which could almost 
certainly be improved upon):

template @pureIfNameHasPure(Sym) {
     static if(__traits(identifier, Sym).canFind("Pure))
         alias @pureIfNameHasPure = @pure;
     else
         alias @pureIfNameHasPure = /* nothing...not sure how to 
show that */;

}


More information about the Digitalmars-d mailing list