DIP6: Attributes

yigal chripun yigal100 at gmail.com
Tue Aug 4 02:14:36 PDT 2009


grauzone Wrote:

> Daniel Keep wrote:
> >> Yes, but then they're just keywords, with an @ in front. You'd just be
> >> kidding yourself if you think you've reduced the keyword count.
> > 
> > I suspect the reasoning goes like this:
> > 
> > * I want attributes.  Walter doesn't see the use.
> > * Walter complains about adding keywords.
> > * I can make keywords look like attributes, and then I get attributes!
> > 
> > :P
> 
> 
> The idea is just stolen from C#/Java. I guess the idea is that 1. 
> keywords/annotations are in a different namespace and 2. even compile 
> time "keyword" annotations can be handled as normal identifiers. The 
> second point means introducing a new keyword is like declaring a new 
> identifier in object.d.
> 
> But it would also allow users shadowing annotation "keywords" by 
> defining their own annotations, which might be a problem or not.

IIRC, in C# you can use keywords as identifiers.
int @if = 3; // this is a variable called "if"
the @ in C# is a way to tell the parser - "don't treat this as a keyword". 



More information about the Digitalmars-d mailing list