Le 07/11/2012 09:32, Nathan M. Swan a écrit :
On 11/06/2012 10:18 AM, Walter Bright wrote:
For User Defined Attributes.

In the north corner we have the current champeeeeon:

-------
[ ArgumentList ]

Pros:
precedent with C#
looks nice

Cons:
not so greppable
parsing ambiguity with [array literal].func();

------
In the south corner, there's the chaaaaallenger:

@( ArgumentList )

Pros:
looks like existing @attribute syntax
no parsing problems

Cons:
not as nice looking
------

No hitting below the belt! Let the games begin!

[], because @ should be reserved for future language keywords.

Whenever people post suggested language features that require some
marking, they introduce a new @attribute, because introducing a plain
keyword breaks code. If you have @UDAs, this further limits language
expansion.

Example: let's say you want to introduce a "nogc" mark:
1. Not a nogc keyword, that could break "bool nogc;"
2. If you have @, @nogc could break an "enum nogc;" attribute.
3. Now you're stuck with __nogc or #nogc or something uglier.

There is a familiar-to-other-langauges advantage to @, but there is a
better-than-other-languages advantage to [].

My thoughts,
NMS

I think D has already too many feature, and that many of them can be implemented as attribute + AST processing.

D should work toward getting this AST stuff and stop adding new keywords all the time.

Reply via email to