The Wrong Stuff
Michel Fortin
michel.fortin at michelf.com
Sat Sep 25 06:11:25 PDT 2010
On 2010-09-25 08:23:52 -0400, "Simen kjaeraas" <simen.kjaras at gmail.com> said:
> A rose by any other name...
>
> You may label them whatever you want. The fact still is - built-in
> @tributes are reserved words of the language, with special meaning to
> the compiler. If that is not a keyword, I would like to hear a
> common definition of keyword that does not include @tributes, and a
> definition of what @tributes are in comparison.
Just to add to your point: Objective-C is an extension of C that
defines a few more keywords too. Most of which are prefixed with @ so
they don't conflict with anything, yet they're said to be keywords. I
concur with Simen: this "attribute" vs. "keyword" thing is just a
naming convention.
The D community has chosen to call "attributes" the keywords that are
prefixed by @ in an attempt to "reduce" the number of keywords (because
some have criticized the increasing number of keywords). True, those
"attribute-style keywords" don't take more identifiers as reserved
words. But if you dig a little in the DMD source, you'll see there is
no difference in how these attributes and other keywords are processed
once you have passed the parsing stage, they just become flags on data
structures, just like regular keywords often do.
And to make the matter worse, most attributes are not @attributes [1].
We have a concept of @attribute at the syntactic level, and another
totally different concept of attribute at the semantic level.
[1]: http://www.digitalmars.com/d/2.0/attribute.html
At this stage I've lost all hopes of coherency in that part of the
language. To me, the explanation to differentiate the two is quite
simple: an historical incident made all new keywords added after a
certain date use the @attribute syntax.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list