Thread overview
About @ and UDA
Apr 15, 2015
Andrea Fontana
Apr 15, 2015
Jacob Carlborg
Apr 15, 2015
ketmar
Apr 16, 2015
Vlad Levenfeld
Apr 16, 2015
Marc Schütz
Apr 17, 2015
Sönke Ludwig
Apr 17, 2015
Jacob Carlborg
Apr 18, 2015
Jacob Carlborg
April 15, 2015
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).


Andrea
April 15, 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
April 15, 2015
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!")

April 16, 2015
On Wednesday, 15 April 2015 at 16:59:12 UTC, ketmar wrote:
> or make "safe" and company "context keywords". along with "body" (oh, how
> i hate the unabilily to declare "body" member!")

Ugh, yeah. Makes physics code awkward.

April 16, 2015
On Thursday, 16 April 2015 at 20:09:07 UTC, Vlad Levenfeld wrote:
> On Wednesday, 15 April 2015 at 16:59:12 UTC, ketmar wrote:
>> or make "safe" and company "context keywords". along with "body" (oh, how
>> i hate the unabilily to declare "body" member!")
>
> Ugh, yeah. Makes physics code awkward.

And DOM.
April 17, 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.).
April 17, 2015
On 2015-04-17 16:34, Sönke Ludwig wrote:

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

UDA's were available when these attributes/keywords were created. Reasons why they're still not UDA's are probably a mix of avoiding code breakage and someone that needs to make the change.

-- 
/Jacob Carlborg
April 18, 2015
On 2015-04-17 21:35, Jacob Carlborg wrote:

> UDA's were available when these attributes/keywords were created.
> Reasons why they're still not UDA's are probably a mix of avoiding code
> breakage and someone that needs to make the change.

Were _not_ available ...

-- 
/Jacob Carlborg