On Wednesday, 4 September 2013 at 17:07:33 UTC, Timothee Cour
wrote:
IIRC, &foo.x with x a property should take address of return
value of x(),
which will either fail to compile or do the right thing if it
returns a
lvalue.
It is not possible because getters are not guaranteed to return
lvalues. There is a quite elegant (in my opinion) proposal
hanging around to allow annotating plain fields with @property so
that compiler will prohibit doing any operation on them that may
later break because of transition to actual properties, such as
taking address.
As for side effects, this is the reason one would go from field
access to
property, eg populating some data upon 1st access to a field x.
Sure it can
be misused, but I haven't seen a case in practice where it is
misused.
I haven't seen a case in practice when using normal method
instead of a property was really harmful. Also modifying own
members is legal for weakly pure method as far as I remember (it
can modify arguments, including hidden `this`), so your case will
actually work within my restrictions.