[Xotcl] Object destruction on exit

Jeff Hobbs jeffh at ActiveState.com
Fri Feb 3 00:24:03 CET 2006


Gustaf Neumann wrote:
> Kristoffer Lawson schrieb:
> > When XOTcl exits, it seems that the [destroy] method is called on all
> > objects. The first question is whether this is wise .. possibly. 
> 
> well, it was some work to do so, and i think this is 
> important from the oo-point-of-view.

Some work to enable?  The general deletion of a Tcl interpreter
will call any associated deletion callback for AssocData and
commands.  The one exception is for the last interpreter in a
"common" shell environment, which doesn't get deleted normally
(unless exit is undefined or you compile with -DPURIFY).

> If one allocates "external resources" (e.g. temp-files, register on a 
> whiteboard, etc)
> and deallocates these resources in a destructor, the 
> deallocation should certainly
> happen, when the program exists gracefully.

The graceful deallocation argument is mostly spurious, as the OS
cleans things up on program exit, but freeing of external
resources is important.  This is why I'm considering fixing that
"last interp" exception above.

Jeff



More information about the Xotcl mailing list