View · Search · Index
No registered users in community xowiki
in last 10 minutes

[Xotcl] Mixins don't respect class hierarchy

From: Arthur Schreiber <schreiber.arthur_at_googlemail.com>
Date: Thu, 23 Feb 2012 11:29:04 +0100

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