[Xotcl] Precedence Order
Scott Gargash
scottg at atc.creative.com
Tue Aug 29 19:21:23 CEST 2006
As I understand it, precedence order is computed as filters then mixins
the superclasses, and this sort order is applied "globally" to an object.
In other words:
Class create Base
Class create Derived -superclass Base
Derived d
d info precedence ==> ::Derived ::Base ::xotcl::Object
Class create BaseMixin
Base instmixin add BaseMixin
d info precedence ==> ::BaseMixin ::Derived ::Base ::xotcl::Object
This behavior seems to violate encapsulation. BaseMixin is intended to
intercept messages to Base. Derived doesn't know about BaseMixin and
BaseMixin doesn't know about Derived, yet BaseMixin ends up being the
first interceptor of messages to Derived.
Since BaseMixin is intended to modify the behavior of Base, it would be
better BaseMixin preceeded Base (and only Base) in the sort order.
d info precedence ==> ::Derived ::BaseMixin ::Base ::xotcl::Object
The current behavior means you can't really add a mixin without
understanding everywhere that the object being extended is used. Is there
some benefit to the current behavior that I don't understand?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://alice.wu-wien.ac.at/pipermail/xotcl/attachments/20060829/3722d0ca/attachment.html
More information about the Xotcl
mailing list