View · Search · Index
No registered users in community xowiki
in last 10 minutes

[Xotcl] How to overload Class destroy?

From: Zoran Vasiljevic <zv_at_archiware.com>
Date: Tue, 4 Jan 2005 16:35:29 +0100

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