DIP28, on properties, availabel for destruction as well

Jacob Carlborg doob at me.com
Wed Feb 27 12:09:50 PST 2013


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.

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;

I would prefer if that gets rewritten to:

Point __tmp = w.getter;
__tmp.x = 3;
w.getter = __tmp;

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list