DIP64: Attribute Cleanup

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 21 22:07:22 PDT 2014


On Sat, 21 Jun 2014 20:48:40 +0000
Brian Schott via Digitalmars-d <digitalmars-d at puremagic.com> wrote:

> On Saturday, 21 June 2014 at 19:41:42 UTC, Jonathan M Davis via
> Digitalmars-d wrote:
> > And to add to that, this proposal doesn't even make things
> > consistent. You
> > _still_ have to explain why some attributes have @ and some
> > don't. It's just
> > that now two of them have @ whereas they didn't before. final,
> > static, public,
> > const, etc. all still don't have @, and they're all function
> > attributes too.
>
> I think the proposal said that the type constructors would be
> exempt, You wouldn't have @const but you would have @final.

I thought that it called out pure and nothrow explicitly. I'll have to reread
it.

> > So, it doesn't increase consistency. It just moves it around.
> > And then we have
> > to explain why some older code or tutorials _don't_ have @ on
> > pure or nothrow,
> > making it so that we have _more_ to explain.
>
> We can either say "It used to be inconsistent, but then we did
> nothing", or "It used to be inconsistent, but then we fixed it.
> Run this tool on your code and you'll be fine."

But as far is I can tell, this doesn't even make the language consistent.  It
just moves the inconsistencies around.

> > I appreciate the sentiment of wanting to clean things up and
> > make them more
> > consistent, but I really don't think this does that. If we want
> > that, we'd
> > either have to add @ to all attributes or remove it from all
> > attributes. But
> > then of course, we'd have stuff like @public and @static, which
> > is
> > inconsistent with other languages and would probably cause
> > folks to complain
> > about unnecessary inconsistencies with othe languages. So, I
> > really don't
> > think that we can avoid this problem. It's just a question of
> > which form of it
> > we want to deal with and how much code breakage we're willing
> > to put up with
> > to get it there.
>
> Why is D being consistent with other languages a more important
> goal than D being consistent with D?

It's not, but there _is_ a cost to making it less consistent with other
languages, especially when it's _currently_ consistent with them. And it's
definitely not worth becoming inconsistent with other languages IMHO if
you're not actually fixing the inconsistencies in D at the same time. We
either need to make attributes _completely_ consistent, or there's no point in
changing any of them. And that would mean either putting @ on the front of
_all_ of them or _none_ of them, not simply adding @ to a few of them.

- Jonathan M Davis


More information about the Digitalmars-d mailing list