Properties: a.b.c = 3

Zhenyu Zhou rinick at gmail.com
Wed Jul 29 01:39:49 PDT 2009


Daniel Keep Wrote:
> Maybe the compiler could rewrite the above as:
> 
> auto t = a.b;
> t.c = 3;
> a.b = t;
> 
> Unless it can prove it doesn't need to.  Same solution as to the op=
> conundrum.

I think b should be const if it is a temporary object.
And the compiler will tell you  that a.b.c  is read only.

Otherwise, don't make it look like a property:
a.createNewB().c = 3;




More information about the Digitalmars-d mailing list