[Xotcl] Filter Problem - Help!
Sheik Yussuff
sheik@carib-link.net
Tue, 7 Aug 2001 22:51:22 -0300
Below is sample code to illustrate a problem I
am having with filters.
1. Object a is sent the message mb(not an instproc) of A
2. Filter af of object a intercepts and
dispatches method mbb to object b
3. Filter bf of object b intercepts and
redispatches method maa to object a
4. This time the filter af does not intercept method maa!!
The method maa is sent directly to object a with
the resulting error: object a unable to dispatch
method maa.
Can anyone assist me in explaining what is happening here?
------------------------------------------------------------
#Code: Win 95 version 0.85
Class A -parameter {delegate}
A instproc af args {
set method [self calledproc]
if {[[self] exists delegate]} {
set del [[self] set delegate]
if {$method == "maa"} {
return [eval $del mbb]
}
if {$method != "ma"} {
return [eval $del $method $args]
}
}
next
}
A filter {af}
A instproc ma args {
puts "method ma of A"
}
Class B
B instproc bf args {
set sender [self callingobject]
set method [self calledproc]
puts "method is: $method"
if {$method == "mb"} {
return [eval $sender maa]
}
next
}
B filter bf
B instproc mb args {
puts "method mb of B"
}
B instproc mbb args {
puts "method mbb of B"
}
#Test case
B b
A a
a delegate b
#a ma
a mb