Revised RFC on range design for D2

Steven Schveighoffer schveiguy at yahoo.com
Tue Sep 30 06:52:04 PDT 2008


"Andrei Alexandrescu" wrote
> Andrei Alexandrescu wrote:
>> 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?
>
> I actually did have something in mind when I wrote this, just didn't want 
> to bias anyone.
>
> My thinking is that the syntax "a.b = c" in lieu of a.b(c) for a function 
> a.b(T x) should be allowed if and only if there also exists a function 
> a.b() that returns a value of type T.

What about functions with default parameters?

struct S1
{
   int prop(int x = 0) {...}
}

I admit I have no idea how this should be interpreted.  The author may have 
intended for this to compile:

s1.prop = 5;

-Steve 




More information about the Digitalmars-d-announce mailing list