User Defined Attributes

Jonathan M Davis jmdavisProg at gmx.com
Wed Nov 7 04:08:51 PST 2012


On Wednesday, November 07, 2012 13:01:52 Jacob Carlborg wrote:
> On 2012-11-07 12:05, Leandro Lucarella wrote:
> > OK, that's another thing. And maybe a reason for listening to people
> > having
> > more experience with UDAs than you.
> > 
> > For me the analogy with Exceptions is pretty good. The issues an
> > conveniences of throwing anything or annotating a symbol with anything
> > instead of just type are pretty much the same. I only see functions
> > making sense to be accepted as annotations too (that's what Python do
> > with annotations, @annotation symbol is the same as symbol =
> > annotation(symbol), but is quite a different language).
> I start to more and more think it would be better to explicitly require
> the developer to declare an attribute, like:
> 
> attribute foo
> {
>      string name;
> }
> 
> @foo("asd") int a;

Isn't that how it works in Java? It's been a while since I've done much with 
Java, but IIRC that's essentially how it works in Java.

- Jonathan M Davis


More information about the Digitalmars-d-announce mailing list