On Mon, 28 Jan 2013 15:00:41 -0500, Jacob Carlborg <[email protected]> wrote:
On 2013-01-28 17:21, Steven Schveighoffer wrote:
But I think it would be wasteful in the given case. __a is already in
the register, I think actually the return __a is a noop.
In other cases, where the property value may be a large struct or
whatnot, not returning the new value from a setter would make sense.
It would be nice if the compiler made the right choice depending on
whether you returned a value from the property or not.
Then it's up to the compiler to implement them, I don't need to know the
details in the optimizations it can do.
Like I said, the synthesizing of properties can be done via a library.
The compiler simply needs to call the getter when the setter returns void,
or return the setter's return value when it returns a value.
-Steve