May 04, 2005
The 'class NotOk' example fails to compile with the error message:

"need 'this' to access member write"

------------------
class Ok {
    void write(int v) { }

    template rwop(alias F) {
	void op() { write(F(42)); }
    }

    ubyte asl(ubyte b) { return b << 1; }

    mixin rwop!(asl) rwAsl;

    void run() {
	rwAsl.op();
    }
}
---------------------
class NotOk {
    void write(int v) { }

    template rwop(alias F) {
	void op() { write(F(42)); }
    }

    ubyte asl(ubyte b) { return b << 1; }

    void run() {
	// this works...
	void rwAslOp() { write(asl(42)); }
	rwAslOp();

	// ... but this does not
	mixin rwop!(asl) rwAsl;
	rwAsl.op();
    }
}
--------------------


David
May 14, 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David Friedman schrieb am Tue, 03 May 2005 20:39:00 -0400:
> The 'class NotOk' example fails to compile with the error message:
>
> "need 'this' to access member write"
>
> ------------------
> class Ok {
>      void write(int v) { }
>
>      template rwop(alias F) {
> 	void op() { write(F(42)); }
>      }
>
>      ubyte asl(ubyte b) { return b << 1; }
>
>      mixin rwop!(asl) rwAsl;
>
>      void run() {
> 	rwAsl.op();
>      }
> }
> ---------------------
> class NotOk {
>      void write(int v) { }
>
>      template rwop(alias F) {
> 	void op() { write(F(42)); }
>      }
>
>      ubyte asl(ubyte b) { return b << 1; }
>
>      void run() {
> 	// this works...
> 	void rwAslOp() { write(asl(42)); }
> 	rwAslOp();
>
> 	// ... but this does not
> 	mixin rwop!(asl) rwAsl;
> 	rwAsl.op();
>      }
> }
> --------------------

Added to DStress as http://dstress.kuehne.cn/run/m/mixin_13_A.d http://dstress.kuehne.cn/run/m/mixin_13_B.d

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFChcEt3w+/yD4P9tIRAm8mAKDLrolrXx/lrjHcYcFIKbAgXIiKqgCfZHKW
BbuIJ27ckwmEcVppmEdWF3o=
=wtSg
-----END PGP SIGNATURE-----