properties as lvalues

Daniel Keep daniel.keep.lists at gmail.com
Mon May 15 03:23:49 PDT 2006



Ivan Senji wrote:
> cschueler wrote:
>> From the specs:
>>
>> Note: Properties currently cannot be the lvalue of an op=, ++, or -- operator. 
>>
> 
> It would also be nice if things like this worked:
> 
> class A
> {
>   int a { return 3; } //get
>   int a(int value){}  //set
> }
> 
> void func(ionut int x);
> 
> auto z = new A;
> 
> func(z.a);
> 
> wich would be equivalent to:
> 
> auto za = z.a(); //get
> func(za);
> z.a(za);         //set

One of the weird things I remember about VB6 was that it would allow you
to pass an intermediate value ByRef to another function.  Imagine my
surprise when I starting playing with "real" programming languages like
C++, and absolutely none of them were capable of this.

I never really understood why it was seemingly so hard to implement.
After all, even if it *is* an intermediate value, it's got to be stored
somewhere in memory, right?

	-- Daniel

-- 

v1sw5+8Yhw5ln4+5pr6OFma8u6+7Lw4Tm6+7l6+7D
a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP    http://hackerkey.com/



More information about the Digitalmars-d mailing list