Proposal: Definition of @-attributes

Clemens eriatarka84 at gmail.com
Fri Jan 29 02:41:00 PST 2010


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.

Clemens



More information about the Digitalmars-d mailing list