Revised RFC on range design for D2

Chris R. Miller lordsauronthegreat at gmail.com
Sun Sep 28 12:22:40 PDT 2008


torhu wrote:
> 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.

My concern is that this could break existing code.  If the presence of 
an equals sign allows the use of the property syntax, then suddenly code 
needs to be updated that is supposed to be able to be used like a 
property.  Perhaps something to explicitly disallow the use of the 
property syntax?


More information about the Digitalmars-d-announce mailing list