On 2013-01-04 16:45, Philippe Sigaud wrote:
Syntax:
@(3) int a;
@("string", 7) int b;
enum Foo;
@Foo int c;
struct Bar
{
int x;
}
@Bar(3) int d;
From that, I get we can put any CT symbol (even a value) as an
attribute. I thought we were restricted to user defined types.
No, basically anything that can be put in a tuple can be used as an UDA.
I'm wondering if we want to add a meta attribute to Phobos or druntime
(object.d). Some thing like:
enum attribute;
@attribute struct Foo { }
Now, by convention "Foo" is an attribute and should only be used as an
attribute. We could also add some functions to std.traits for querying
UDA that takes advantage of this attribute.
--
/Jacob Carlborg