On Fri, 08 Oct 2010 09:30:59 -0400, Denis Koroskin <2kor...@gmail.com> wrote:

C# uses 'this' keyword for that purpose:

@property int set(this int x, int y)
{
     x = y;
}


@property int get(this const(int) x)
{
     return x;
}

int a = 1;
a.set(42); // a is 42 now
3.set(42); // fails to compile, 3 is of type const(int)

Using this is a good idea, but I don't think we should automatically ref the value. Also this is already a symbol name, can't we just use it? What I think might be a good idea is to *name* the target this, and then just allow the normal adornments to describe the type. i.e.:

@property int set(ref int this, int y) {}

will work only for lvalues, whereas

@property int set(int this, int y) {}

works for rvalues also.  The

What do you think?

-Steve

Reply via email to