mixin operators

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


Jason O'Brien wrote:
> 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.

sigh.. wrong newsgroup. sorry



More information about the Digitalmars-d mailing list