[Xotcl] Issue with mixin delete

Scott Gargash scottg at atc.creative.com
Tue May 2 00:35:26 CEST 2006


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]"
  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]"

Class Mixin3
Mixin3 instproc destroy {args} {
  puts "Mixin3 1: [my info mixin]"
  my mixin delete ::Mixin3
  puts "Mixin3 2: [my info mixin]"

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: ::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


The information in this message is confidential and may be legally privileged.  It is intended
solely for the addressee.  Access to this message by anyone else is unauthorized.  If you are not
the intended recipient,  any disclosure,  copying or distribution of the message,  or any action
taken by you in reliance on it,  is prohibited and may be unlawful.  If you have received this
message in error,  please delete it and contact the sender immediately.  Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://alice.wu-wien.ac.at/pipermail/xotcl/attachments/20060501/9599d0f7/attachment.html

More information about the Xotcl mailing list