Property change problem

Zarathustra adam.chrapkowski at gmail.com
Mon Jul 21 11:29:48 PDT 2008


Koroskin Denis Wrote:

> On Mon, 21 Jul 2008 21:26:04 +0400, Jarrett Billingsley  
> <kb3ctd2 at yahoo.com> wrote:
> 
> > "Zarathustra" <adam.chrapkowski at gmail.com> wrote in message
> > news:g62dv7$gao$1 at digitalmars.com...
> >
> >>  l_bar.foo.u.a = 5;   // no effect
> >
> > I really wish the compiler could catch stuff like this.  It has no effect
> > because it's doing something like this:
> >
> > auto temp = l_bar.foo.u;
> > temp.a = 5;
> >
> > And then throwing away 'temp'.  That is, it's not modifying l_bar.foo.u,
> > it's modifying a temporary copy of it.
> >
> > It would work if u() returned an SSome* (that is, "return &this.m_u;"),  
> > but
> > I don't know if that's acceptable for you.
> >
> >
> 
> That's why we need C++-style references!

Hmm it's realy strange and in my opinion it harms the properties idea. Maybe, one day it will be changed. I hoped that was only my mistake :(. Ok, thanks a lot for help and if anybody know other solution I would like to know it.


More information about the Digitalmars-d-learn mailing list