[Xotcl] Issue with mixin delete

Gustaf Neumann neumann at wu-wien.ac.at
Sun May 7 01:10:24 CEST 2006


Scott Gargash schrieb:
>
> 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.
>
scott,

in your example, you are trying to delete the currently active mixin 
from the mixin list (xotcl needs it
currently to continue from that point in the mixin chain), and then you 
are deleting the object anyhow.
Most probably, we should rise an error in such cases.

what is your intention, what lead you to this construction?

-gustaf
>
>
> 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
>
> ------------------------------------------------------------------------
> *Notice*
> 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.
> ------------------------------------------------------------------------
>
> _______________________________________________
> Xotcl mailing list
> Xotcl at alice.wu-wien.ac.at
> http://alice.wu-wien.ac.at/mailman/listinfo/xotcl
>   



More information about the Xotcl mailing list