About @ and UDA

Jacob Carlborg via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Apr 15 02:21:41 PDT 2015


On 2015-04-15 10:53, 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.

Yes, it would be a crazy idea. Actually, there's already another syntax, 
deprecated, for UDA's. It was deprecated when it was added. Then the 
current syntax was added.

> 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).

No, the solution is to add any new attributes, not as keywords but as 
compiler recognized UDA's. Then it's possible to use the fully qualified 
name of the UDA to disambiguate.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list