alias this doesn't work for properties.

JS js.mdnq at gmail.com
Thu Aug 1 13:42:07 PDT 2013


http://dpaste.dzfl.pl/0c923861

class A
{
     double x;
     @property double X() { return x; }
     @property double X(double v) { return x = v; }
     alias X this;
}

class B
{
     A a;
     @property A Y() { return a; }
     @property A Y(A v) { return a = v; }
}


void main()
{
	B b = new B();
	b.Y = 3;
}

error not a property of b.Y



adding refs to the returns of the getters allows the code to work 
but only getters are called(hence the need for refs).

Please allow alias this to work with overloaded functions. 
(specifically properties, b.Y = 3; is not b.Y() = 3 but b.Y(3);)


More information about the Digitalmars-d mailing list