On Thursday, 28 February 2013 at 08:02:05 UTC, Jacob Carlborg wrote:
On 2013-02-28 04:00, deadalnix wrote:

The proposal is to rewrite that to auto a = b.setter(3);

Its value is whatever the setter returns.

Then setters always must return a value. I think it would be better to have the compiler rewrite the expression to return what the getter returns.


Must is not appropriate here, as it isn't an obligation at all. I don't really see what is the concern here.

If the function is simple, then it will be inlined and unused returned values can be optimized away. If the function is complex, the cost of returning something when not needed will be negligible anyway.

What is your concern here ?

Error, w.getter is not an lvalue.

Then you cannot freely change a field to a property.


You can return an lvalue. But you example was returning an rvalue; so it is an error in this case.

Reply via email to