Sun, 26 Sep 2010 09:26:28 -0400, Michel Fortin wrote: > On 2010-09-26 03:56:32 -0400, Don <nos...@nospam.com> said: > >> I was just referring to the "without having to add new keywords" bit. >> And a fairly general comment to the whole thread (not just this post). >> I meant that __keywords are available, and the argument that @ provides >> a namespace for keywords is completely wrong, and utterly dreadful. I'm >> a bit disturbed that people are even thinking in that way. > > People (including me) are thinking that way because there is no sane > semantic definition of what the @ syntax stands for. I'll grant you one > thing: @attributes are only used to affect declarations in one way or > another, so as long as this stands they're more limited in purpose than > keywords in general. But beyond that, what makes @ different from > another namespace for keywords? > > >> See also the August 28 post by Herb Sutter: http://herbsutter.com/ >> >> "My biggest (but not only) beef with C++0x [[attributes]] is that the >> standard itself was abusing attributes as disguised [[keywords]]. >> Attributes are acceptable as pure annotations, but they should have no >> semantic effect on the program. >> [snip] >> it’s a clear example of adding language keywords dressed in attributes’ >> clothing, and not something I want to be responsible for forcing three >> million C++ developers to live with until the end of time." > > Unfortunately, one attribute with the @ syntax in D -- and I'd say the > flagship one as it was the first and most discussed -- is not a pure > annotation as it has a noticeable effect on semantics. I'm talking about > @property which, if it ever get implemented, changes your function so it > simulates a field. In Herb's terms, @property is clearly a keyword in > disguise. > > And then you realize many keywords fit that same definition of an > attribute (deprecated, pure, nothrow...) and you're left with a very > fuzzy concept of what the @ syntax is for. We have an important keyword > disguised as an @attribute (@property) and attributes disguised as > keywords for historical reason (deprecated, pure, nothrow...). Whatever > the @ syntax was supposed to stand for, it's pretty messed up right now. > > There's also confusion about the term "attribute" itself. Try reading > that page and come with a sane definition of what is an attribute in D. > <http://digitalmars.com/d/2.0/attribute.html>
This just makes me wonder, why is it so *** hard to get things right? I remember when D didn't have the @stuff syntax at all. I wished it worked like annotations in Java or in C#. If I made my own 3rd party lint/ document_generator/unit_test_tool/whatever, and I'd just want a way to decorate some syntax tree nodes. How can it be so hard to do this? Can you use your own @annotations now? Probably not. There's only the @property syntax, nothing else. The __traits keyword was also supposed to change to 'traits' or something a bit more sane. Nothing really happened. Why am I using this language?