Proposal: Definition of @-attributes
retard
re at tard.com.invalid
Fri Jan 29 04:25:47 PST 2010
Fri, 29 Jan 2010 05:41:00 -0500, Clemens wrote:
> Leandro Lucarella Wrote:
>
>> Lars T. Kyllingstad, el 28 de enero a las 15:38 me escribiste:
>> > >I think all D attributes should have the @, if you have a bunch of
>> > >them, maybe there should be a way to group them, like:
>> > >
>> > > @(safe nothrow private property) int foo() { ... }
>> > >
>> > >But I'm not sure that adds anything to readability. I don't think
>> > >this is a huge problem, since as somebody already pointed out, you
>> > >can always group declarations with the same attributes together and
>> > >type the attribute just once (this is not Java :).
>> >
>> > That doesn't look too bad, but if *all* attributes are in the
>> > @-namespace, then we *really* should keep user-defined annotations
>> > out of it.
>>
>> I don't know, maybe you're right.
>>
>> (thinking out loud, what's next can be a load of crap, be warned :)
>
> If and when D gets user-defined attributes, they could have their own
> namespace:
>
> @@foo
> or maybe
> #foo
>
> (Is # used for anything at all in D right now?)
>
> Maybe it's too ugly though, but then the current attribute syntax isn't
> a thing of beauty to begin with.
I'm wondering. If I make a tool that parses D sources such as a
documentation generator, can I define new annotations freely or are there
any rules involved? I could really have use for e.g. unit testing
annotations. The compiler should ignore them, however - preferably now
and also in the future.
More information about the Digitalmars-d
mailing list