User Defined Attributes

Walter Bright newshound2 at digitalmars.com
Wed Nov 7 15:19:21 PST 2012


On 11/7/2012 3:06 PM, Kapps wrote:
> I do agree however with preventing any built-in types / literals being used as
> an annotation. It's just not safe, completely goes around the module system, and
> is abused in the same way as it would be with C++ exceptions. In C# for example,
> all attributes are classes derived from Attribute. This makes things a bit more
> obvious, allows a common base type (probably not needed in D because it's done
> at compile-time), but is rather hackish in my opinion (plus, in D you may want
> structs as attributes?). I definitely would like to see something like the
> @attribute suggestion though. Using types not meant to be used as attributes as
> attributes is dangerous and leads to conflicts when people want it to mean
> different things. What does '@Vector3f(1, 1, 1) int a' even mean? What if people
> use it to mean different things? It's just as confusing as '@3 int a'.

See new thread I started on this in digitalmars.D.


More information about the Digitalmars-d-announce mailing list