mixin operators

Jason O'Brien xergen at hotmail.com
Wed Aug 2 17:55:42 PDT 2006


template TestMixin(){
     void opCall()    {
     }

     void opCatAssign(uint val)    {
     }
}

class Test{
     mixin TestMixin bar;

     void foo(){
	//bar(); // doesn't work !?!?
	bar.opCall(); // works
	//bar ~= 3; // doesn't work
	bar.opCatAssign(3); // works
     }
}

void main(char[][] args){
     Test t = new Test();
     t.bar ~= 3; // works
     t.bar(); // works
     t.bar.opCall(); // works

     t.foo();
}

May seem trivial, but its actually pretty important for some friendly 
things im working on.  Mixin operators can't be called from within the 
scope using the mixin? Odd :) Thanks.
PS. You're my hero Walter.



More information about the Digitalmars-d mailing list