Prev: How to know the memory used by a Tcl program?
Next: TclOO: Is it possible that destructor is called on an object,but constructor is not?
From: Donal K. Fellows on 24 Jan 2010 11:39 On 24 Jan, 11:00, Georgios Petasis <peta...(a)iit.demokritos.gr> wrote: > Not an important problem, but I observe the following when an error occurs: [...] > These are widgets, and if an error is cause in another widget, objects > are destroyed through Tk events. But since an object exists to call the > destructor, this means that the constructor has ran, isn't it so? If the class was mixed into an instance, it would not have the constructor called. If you are doing something complex with inheritance and not using [next] in constructors somewhere, it is possible for a constructor to get missed. (Unlike some languages, the calling of [next] in the constructor is optional. In part, that's because "constructors" don't actually make the object itself.) That's not due to an inheritance error per se, but does indicate that something you've been doing has gone wrong. It might be easier to rework the code so that it doesn't rely on the variable existing; [info exists] is now a very cheap operation. Donal. |