[Xotcl] How to overload Class destroy?

Zoran Vasiljevic zv at archiware.com
Tue Jan 4 16:35:29 CET 2005


Hi!

What I want to achieve is to get informed each time a Class is getting 
destroyed. I do need to know the name of the class and its calling
environment (namespace).

What I did is:

Class create ::xotcl::_destroyer -instproc destroy {args} {
   puts "DESTROY '[self class]'"
   puts "DESTROY '[self calledclass]'"
   puts "DESTROY '[self callingclass]'"
   next
}
Class instmixin ::xotcl::_destroyer

Now...

Class Dummy
Dummy destroy

... gives ...

DESTROY '::xotcl::_destroyer'
DESTROY '::xotcl::Object'
DESTROY ''


What I expected to get was "DESTROY 'Dummy'" or "DESTROY '::Dummy'"
but this does not happen. Why?

Thanks,
Zoran




More information about the Xotcl mailing list