struct inheritance, L-value return

Chris Nicholson-Sauls ibisbasenji at gmail.com
Tue Jun 13 09:38:03 PDT 2006


Oskar Linde wrote:
> cschueler skrev:
>> There is more missing in D that prevents me to port the
>> system fully:
>>
>> - explicit return by reference (return an L-value)
>> - struct constructors
>>
>> These are not showblockers, but missing them is ugly!
> 
> 
> I agree. Those have both been discussed several times. One common 
> implication of not having l-value returns is:
> 
> struct point { int x,y; }
> ....
> MyArray!(point) arr;
> ....
> arr[5].x = 3; // no effect
> 

Write MyArray.opIndex to return a pointer and it will work.  I do still agree with the 
proposal, however.

-- Chris Nicholson-Sauls



More information about the Digitalmars-d mailing list