Revised RFC on range design for D2

torhu no at spam.invalid
Sun Sep 28 11:54:08 PDT 2008


Andrei Alexandrescu wrote:
> I think we all agree that there are some annoyances related to the whole 
> property business, among which the main one is:
> 
> writeln = 4;
> 
> That is quite indefensible :o|. I consider the others rather minor, but 
> that's just a personal opinion.
> 
> How about this. Maybe if we attacked this annoyance in particular, that 
> would be a large bang for the buck without a landslide change in the 
> compiler. We only need some way to inform the compiler, "yes, it's ok to 
> call a.b(c) as a.b = c". Ideas?
> 

Using an equals sign to say that assignment syntax is allowed seems natural:

void prop(=int x) { }  // assignment syntax ok
void prop(= int x) { }  // same thing

Other cases:
void prop(=int x=0) { }  // can called as 'prop;' or 'int z = prop;'
void prop(=int x, int y) { }  // probably syntax error
void prop(=int x, int y=0) { }  // unusual but ok?


Functions with no arguments can still be called without parens.


More information about the Digitalmars-d-announce mailing list