Custom attributes (again)

Adam D. Ruppe destructionator at gmail.com
Fri Apr 6 08:22:51 PDT 2012


On Friday, 6 April 2012 at 15:16:37 UTC, Piotr Szturmaj wrote:
> __traits(getAttributes, x)

Note that my proposal from a couple weeks ago did it this way.

getAttributes returned a TypeTuple. You'd loop through it
with is(typeof()) to extract a specific one.

The key is the type name.

The value is whatever your thing evaluated to:

@attr(10+2) decl;

conceptually the same as

enum tmp = 10+2;
decl.annotations ~= tmp;




More information about the Digitalmars-d mailing list