Official D Grammar

Jonathan M Davis jmdavisProg at gmx.com
Thu Apr 25 20:32:07 PDT 2013


On Wednesday, April 24, 2013 08:39:21 Jacob Carlborg wrote:
> On 2013-04-24 03:40, Jonathan M Davis wrote:
> > That would mean creating more keywords, which would break code. By using
> > @, we avoid having to create new keywords, which I believe was the whole
> > point in the first place. Which attributes got @ on them was fairly
> > arbitrary, but they do definitely serve a purpose. And any new attributes
> > in the future will probably have @ on them for the same reason.
> 
> You can't use the same reasoning anymore since we have UDA. Those will
> conflict with new keywords starting with an @.

True. Adding @blah now risks conflicts where it didn't before, but it still 
risks fewer conflicts that adding a keyword, since a keyword could be used 
anywhere, so adding blah as a keyword would conflict with all uses of blah - 
including @blah - whereas adding @blah would just conflict with @blah. There 
was also some discussion on how to make it so that @blah might not cause 
conflicts (via namespacing or somesuch), but I don't recall if anything came of 
that or how much of applies to the actual UDA implementation.

So, it makes more sense to go with adding an @ attribute than a keyword if we 
have to add a new attribute, because it'll conflict with less, but it's 
definitely true that we no longer have a way to avoid creating conflicts when 
adding attributes without altering the grammar in a manner similar to when we 
made it possible to have attributes starting with @. So, it's that much more 
important that we only add new attributes when we really need them.

- Jonathan M Davis


More information about the Digitalmars-d mailing list