Hello,
I've run into an issue when trying to remove a mixin from an object. It appears that removing a mixin from an object interacts with the method chaining, such that the "next" isn't invoked.
Here's an example:
Class Mixin1
Mixin1 instproc destroy {args} {
puts "Mixin1 1: [my info mixin]"
next
my mixin delete ::Mixin1
puts "Mixin1 2: [my info mixin]"
}
Class Mixin2
Mixin2 instproc destroy {args} {
puts "Mixin2 1: [my info mixin]"
my mixin delete ::Mixin2
puts "Mixin2 2: [my info mixin]"
next
}
Class Mixin3
Mixin3 instproc destroy {args} {
puts "Mixin3 1: [my info mixin]"
my mixin delete ::Mixin3
puts "Mixin3 2: [my info mixin]"
next
}
Object a
puts "a: [a info mixin]"
a mixin set {::Mixin1 ::Mixin2 ::Mixin3}
puts "a: [a info mixin]"
a destroy
And the output is
a:
a: ::Mixin1 ::Mixin2 ::Mixin3
Mixin1 1: ::Mixin1 ::Mixin2 ::Mixin3
Mixin2 1: ::Mixin1 ::Mixin2 ::Mixin3
Mixin2 2: ::Mixin1 ::Mixin3
Mixin1 2: ::Mixin3
Because Mixin1 invokes "next" before "mixin delete", Mixin2's "destroy" method gets invoked. But since Mixin2 invokes "mixin delete" before "next", Mixin3's "destroy" method is not invoked, despite it remaining in the object's list of mixins.
This is not the behavior I would expect, and I can't find it documented anywhere. Is this the intended behavior? What should I do if I want to remove a mixin and then continue executing chained methods.
Scott