Class A is a derived class of meta-class Consultation. In the filter conFilter I would like to obtain the class of the object that received the message "m" when invoking the command: [a m 123]. That is, the class of the original receiver of method "m". (Please see code below).
Thanks for any help.
Regards sheik ......................................................... #Code: Class Consultation -superclass Class
Consultation instproc conFilter args { set method [self calledproc]
#The following is of course not correct! #[self class] evaluates to Consultation; #I need it to evaluate to A. Help!!
if {[[self class] info instprocs $method] == ""} { if { [[self] exists delegate] } { return [eval [[self] set delegate] $method $args] } } next }
Consultation instproc init args { [self] instproc setDelegate {d} { [self] set delegate $d } next [self] filterappend [self class]::conFilter }
Consultation A -parameter delegate
A instproc m {x} { puts "[self] [self class] [self proc] $x" return [next] }
Class B B instproc m {x} { puts "[self] [self class] [self proc] $x" return [next] }
A a B b a setDelegate b # send message m to object a puts "result = [a m 123]"
Please ignore previous post as it was a trivial problem.
Thanks. --sheik ----- Original Message ----- From: Sheik Yussuff sheik@carib-link.net To: xotcl@alice.wu-wien.ac.at Sent: Saturday, July 21, 2001 11:41 PM Subject: [Xotcl] Help: Meta-class and derived Classes
Class A is a derived class of meta-class Consultation. In the filter conFilter I would like to obtain the class of the object that received the message "m" when invoking the command: [a m 123]. That is, the class of the original receiver of method "m". (Please see code below).
Thanks for any help.
Regards sheik ......................................................... #Code: Class Consultation -superclass Class
Consultation instproc conFilter args { set method [self calledproc]
#The following is of course not correct! #[self class] evaluates to Consultation; #I need it to evaluate to A. Help!!
if {[[self class] info instprocs $method] == ""} { if { [[self] exists delegate] } { return [eval [[self] set delegate] $method $args] } } next }
Consultation instproc init args { [self] instproc setDelegate {d} { [self] set delegate $d } next [self] filterappend [self class]::conFilter }
Consultation A -parameter delegate
A instproc m {x} { puts "[self] [self class] [self proc] $x" return [next] }
Class B B instproc m {x} { puts "[self] [self class] [self proc] $x" return [next] }
A a B b a setDelegate b # send message m to object a puts "result = [a m 123]"
Xotcl mailing list - Xotcl@alice.wu-wien.ac.at http://alice.wu-wien.ac.at/mailman/listinfo/xotcl