Le 19/11/2012 10:02, Adam D. Ruppe a écrit :
On Monday, 19 November 2012 at 15:01:36 UTC, Andrei Alexandrescu wrote:
Would you please start a DIP with a paste of this idea?

here it is:
http://www.prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP21

I tried to implement this a while ago and hit some pain after some early
success. The pain was trying to get assignments to work without breaking
other cases like returning ref.

My plan was to make any reference to a @property change to a CallExp or
whatever. But if you do that and it is on the left hand side of an
assignment, you do the wrong thing.

foo = foo + 1;

should generally become:

foo(foo() + 1);

but if there isn't a setter, we should leave it as foo() = foo() + 1;
and finding the setter is a bit of a pain. Then, of course, we ideally
want foo += 1 to work too..


This make it impossible to only define a getter only when one want to return by reference.

Maybe someone who knows the compiler better than me will make it look
easy though.

Reply via email to