Nicholas Clark <[EMAIL PROTECTED]> wrote: > On Sun, Apr 24, 2005 at 09:25:43AM +0200, Leopold Toetsch wrote:
>> Ok, that can be solved by calling A.destroy() first. But what happens, >> if A has finalizers, which may depend on other finalizers? > Doesn't this mean that there's a split here in "finalizer"s that's not being > made. Some finalization actions relate to "free up the memory" of this PMC. With finalizers I ment the TBD split functionality of current destroy. We would have: - finalize: "unuse" resources, e.g. close file handle or DB connection - destroy: free resources, e.g. malloced memory Finalize is IMHO typically that part that corresponds to timely destruction. > Others relate to "this PMC is going away". And as morph involves changing > the internal memory layout of a PMC without it actually going away, only the > first set ought to run. No, not really. If the PMC memory physically goes away or not doesn't matter. C<morph> is basically: destroy_PMC_now_but_keep_storage Px reuse_storage_for_new Px, type But it isn't known, if the last reference to that PMC is reused or not. If it is the last reference then the finalizer has to run, else not. As we don't have reference counts, an assign to an object with finalizers ougth to trigger a GC run, IMHO. > If the two types of action were properly split, would it help solve the > problems? No. Destroy has to be done always, if the PMC needs it (e.g. for the Complex PMC, which has malloced memory) and finalize sometimes (via a GC run). > Anyway, for ponie I'm starting to think that I don't actually need formally > different PMC types, as long as I can change the vtable on a PMC. Is that > possible? Basically yes. Well that's what we have now anyway. A PMC is a rigid structure. All that doesn't fit into a PMC is hanging off some pointers. > ... Or is the only sensible way to change vtables (and generate 16+ > variants) to have different PMC classes? A vtable corresponds directly to a class. The vtable and MMD functions defined in the .pmc file define the behavior of the PMC. > Nicholas Clark leo