Proposal: Definition of @-attributes
Leandro Lucarella
llucax at gmail.com
Thu Jan 28 08:07:48 PST 2010
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 :)
User defined annotation can have namespaces though:
import foo;
@foo.bar f() {
// ...
}
But if foo gets introduced in the future as a language feature, you're
doom. Maybe attributes should be always "imported" and be subject to
lookup rules just like regular funcions?
static import std.attr; // standard
import std.safe: trusted; // standard
import foo: public; // non-standard
@std.attr.nothrow @trusted @public f();
It is a radical change, so I don't expect it to be in D2 of course.
--
Leandro Lucarella (AKA luca) http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
More information about the Digitalmars-d
mailing list