DIP6: Attributes

Adam D. Ruppe destructionator at gmail.com
Sat Aug 1 12:53:22 PDT 2009


On Sat, Aug 01, 2009 at 04:29:28PM -0300, Ary Borenszweig wrote:
> http://www.prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP6

What's the difference between this and a keyword? It seems to be a keyword
with a different name.

For this annotation thing to be really useful, I'd think it should be well,
dynamic for lack of a better word.

You can just list them on an item, then inspect them later in templates:

@magic int a;
[...]

auto annotations = __traits(annotations, a);

assert(annotations[0] == "magic"); // now you can do whatever with this


I wished I had something like this before, but I forgot why....



But if you aren't proposing something like that being possible, then what's
the point of the @ to a keyword? It doesn't seem to be any different.


-- 
Adam D. Ruppe
http://arsdnet.net



More information about the Digitalmars-d mailing list