"ZV" == Zoran Vasiljevic zoran@munich.com writes:
ZV> Hi XOTcl gurus! ZV> Consider this:
ZV> % Class Foo ZV> % Foo instproc init {dir} {puts hallo}
ZV> % Class Bar ZV> % Bar bar ZV> % bar mixin Foo ZV> no value given for parameter "dir" to "init"
ZV> After snooping arround I've found out that mixin's does ZV> not allow any argument passing to the mixin class initializer.
ZV> Is this something normal ? If one needs such functionality ZV> are there any workarounds ?
1. That's a general problem of composing classes with the next-path. "mixin" calls the constructor. If different constructors are composed & constructors should receive args, nearly always they should not receive the same args ...
Therefore, with "generic" methods, like constructors, filters, etc., it is almost always a good choice to use "args" as argument, like:
% Class Foo Foo % Foo instproc init args {puts hallo} % Class Bar Bar % Bar bar bar % bar mixin Foo hallo %
we've once discussed to enforce this (with filters its a MUCH bigger problem, because they nearly always receive different args), but for the sake of compatibility with OTcl its still in the responsibility of the programmer.
2. However, in the "mixin" case we could enable argument passing, because "mixin" has just one argument? The rest could be passed to "init". any objections?
--Uwe