Properties: a.b.c = 3
    Jarrett Billingsley 
    jarrett.billingsley at gmail.com
       
    Tue Jul 28 20:50:33 PDT 2009
    
    
  
On Tue, Jul 28, 2009 at 10:33 PM, Walter
Bright<newshound1 at digitalmars.com> wrote:
> The issue is what if b is a property, returns a temporary object, and that
> temp's .c field is uselessly set to 3?
So, the issue is that 'a.b()' returns a struct by value.  Such return
values should always be considered rvalues.  Furthermore,
'rvalue.field' should also only yield an rvalue.  Therefore, 'a.b.c =
3' should be flagged by the compiler as being as nonsensical as "5 =
x".
The compiler would flag this as an error, and the solution would of
course be to make a.b's return value by reference instead.
    
    
More information about the Digitalmars-d
mailing list