[Laszlo-dev] Mixin problem

Philip Romanik promanik at laszlosystems.com
Wed Mar 5 10:56:12 PST 2008


Hi Don,

I confirmed that your solution works. If I define a constructor in 
the mixin everything is fine:


class Base {
   function Base ( arg1:* = null, arg2:* = null, arg3:* = null, 
arg4:*  = null){
   }
}

mixin Mixin {
   function Mixin ( arg1:* = null, arg2:* = null, arg3:* = null, 
arg4:*  = null)
   {
     super(arg1, arg2, arg3, arg4);
   }
   var _mixin = null;
}

class Testing extends Base with Mixin {

   function Testing ( arg1:* = null, arg2:* = null, arg3:* = null, 
arg4:*  = null) {
     super(arg1,arg2,arg3,arg4);
   }

}


Thanks!

Phil

>Hi Don,
>
>I'm converting the data classes to use mixin and ran into a problem 
>when the constructor takes multiple arguments.
>
>
>Here's a test case:
>
>
>class Base {
>    function Base ( arg1:* = null, arg2:* = null, arg3:* = null,
>arg4:*  = null){
>    }
>}
>
>mixin Mixin {
>    var _mixin = null;
>}
>
>class Testing extends Base with Mixin {
>
>    function Testing ( arg1:* = null, arg2:* = null, arg3:* = null,
>arg4:*  = null) {
>      super(arg1,arg2,arg3,arg4);
>    }
>
>}
>
>This produces the following error:
>
>       [java] ERRORS:
>       [java] Compiler error: at [(unknown): 6]: Error: Incorrect
>number of arguments.  Expected no more than 0.
>       [java]
>       [java] super(arg1, arg2, arg3, arg4)
>       [java]                          ^
>
>
>Thanks!
>
>Phil
>



More information about the Laszlo-dev mailing list