User Defined Attributes

Jacob Carlborg doob at me.com
Wed Nov 7 04:01:52 PST 2012


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;

-- 
/Jacob Carlborg


More information about the Digitalmars-d-announce mailing list