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

RE: [Xotcl] Object destruction on exit

From: Jeff Hobbs <jeffh_at_ActiveState.com>
Date: Thu, 2 Feb 2006 15:24:03 -0800

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