[Xotcl] Help with Filters. Resubmission.

Sheik Yussuff sheik at carib-link.net
Sat Dec 15 16:28:35 CET 2001


Below is nonsensical sample code to illustrate a problem I
am having with filters. On invocation of: 
   a mb (see code section below)
1. Object a is sent the message mb(not an instproc) of A
2. Filter af of object a intercepts and
   dispatches message mbb to object b
3. Filter bf of object b intercepts and
   redispatches message maa to object a
   This time the filter af does not intercept message maa!!
   The message 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 98 version 0.91; got same problem with ver 0.85 3 months ago.

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 instfilter {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 instfilter bf

B instproc mb args {
  puts "method mb of B"
}

B instproc mbb args {
  puts "method mbb of B"
}

B b
A a
a delegate b
#a ma ; #works ok
a mb






More information about the Xotcl mailing list