DIP64: Attribute Cleanup

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 18 05:11:46 PDT 2016


On Monday, April 18, 2016 10:32:39 Satoshi via Digitalmars-d wrote:
> On Friday, 20 June 2014 at 19:22:04 UTC, Brian Schott wrote:
> > http://wiki.dlang.org/DIP64
> >
> > Attributes in D have two problems:
> > 1. There are too many of them and declarations are getting too
> > verbose
> > 2. New attributes use @ and the old ones do not.
> >
> > I've created a DIP to address these issues.
>
> Language defined attribs should be without @ and user defined
> attribs with @
>
> Whats wrong with it?

We started putting @ on attributes to avoid adding new keywords before we
even had user-defined attributes in the language.  Hopefully, we don't need
to add any new keywords, but if we do, we'd almost certainly do it with @ in
order to actually avoid adding another keyword. Certainly, your suggestion
is by far the most sensible from the standpoint of making it easy to figure
out which attributes start with @ and which don't, but it would cost more
keywords than we want to pay.

Regardless, changing any of the attributes now would break a _lot_ of code,
and such a change would have to be worth the pain that it would cause, which
is questinonable. There isn't a consensus on what they should be changed to
(pretty much any change except what you suggested results in inconsistencies
in which ones are prepended with @ and which aren't - it's just a different
set of inconsistencies that we have now, and that arguably defeats the whole
purpose of making the change). There are definitely vocal folks who want the
attributes changed in order to make them more consistent, but as long as
it's not clear what they should be changed to, it'll never happen, and
Walter and Andrei aren't big fans of renaming stuff just to make it more
consistent. It carries a definite cost in terms of code breakage, and it's
highly debatable as to whether it's worth it. So, I don't expect that the
attributes are ever going to get renamed, though if someone can come up with
a good enough scheme and somehow persuade Walter, then maybe it would
happen. I'm not holding my breath though.

- Jonathan M Davis



More information about the Digitalmars-d mailing list