About @ and UDA

Sönke Ludwig via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 17 07:34:45 PDT 2015


Am 15.04.2015 um 18:59 schrieb ketmar:
> On Wed, 15 Apr 2015 08:53:05 +0000, Andrea Fontana wrote:
>
>> My 2 cents. If I remember correctly, "@" prefix in @safe, @trusted,
>> @system, etc was added just to avoid keywords pollution, right?
>>
>> Now UDA uses the same prefix: if some new keywords/properties/attributes
>> will be added to D, the same problem will come back again... Is it a
>> crazy idea to deprecate @
>> for UDAs in favor of something else like #? In this way @xxx will be a
>> language attribute and #xxx will be a user defined attribute. No
>> pollution, no clashes.
>>
>> Maybe it's not too late to do this change. I think it will be not a big
>> effort to replace uda syntax in existing projects (a deprecation warning
>> will help).
>
> or make "safe" and company "context keywords". along with "body" (oh, how
> i hate the unabilily to declare "body" member!")

+1 for body

I still haven't got the reason though, why "safe" and friends cannot 
simply be UDAs defined in object.d that the compiler recognizes. I'd 
also reserve a bunch of @attributes now to avoid a never ending sequence 
of breaking changes (such as good anti-keywords to scope, immutable, 
pure etc.).


More information about the Digitalmars-d-learn mailing list