On Wednesday, 27 February 2013 at 20:09:51 UTC, Jacob Carlborg
wrote:
On 2013-02-27 16:46, deadalnix wrote:
Here come the sister of DIP27 : DIP28
http://wiki.dlang.org/DIP28 .
It address specifically properties. A 3rd one is coming on
delegate. As
for DIP27, the goal is to go aggressively for simplicity.
What happens if you do:
auto a = b.setter = 3;
I see two alternatives:
A. It's rewritten to this:
auto __tmp = 3;
b.setter = 3;
auto a = __tmp;
B. It's rewritten to this:
b.setter = 3;
auto a = b.getter;
I prefer B.
The proposal is to rewrite that to auto a = b.setter(3);
Its value is whatever the setter returns.
What happens if you do:
struct Point
{
int x;
int y;
}
class Widget
{
@property Point getter();
@property Point setter(Point);
}
auto w = new Widget;
w.getter.x = 3;
Error, w.getter is not an lvalue.
I would prefer if that gets rewritten to:
Point __tmp = w.getter;
__tmp.x = 3;
w.getter = __tmp;
That would be an error as well, for the same reason.