[Xotcl] Mixins don't respect class hierarchy

Arthur Schreiber schreiber.arthur at googlemail.com
Thu Feb 23 11:29:04 CET 2012


Hello Gustaf,

playing around with mixins, I came across the following behaviour:

package require nx

nx::Class create TestMixin {
    :public method test {} {
        puts "mixin"
    }
}

nx::Object mixin TestMixin

nx::Class create TestClass {
    :public method test {} {
        puts "class"
    }
}

set test [TestClass new]
puts [$test info precedence]; # => ::TestMixin ::TestClass ::nx::Object
$test test; # => mixin

Is that intended? I would have expected that the class hierarchy of
::TestClass instances would look like "::TestClass ::TestMixin
::nx::Object".

Kind regards,
Arthur


More information about the Xotcl mailing list