Bob Rogers <[EMAIL PROTECTED]> wrote:
>    From: Leopold Toetsch <[EMAIL PROTECTED]>

>    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.

> Is that really necessary?  After a PMC has been morphed, it seems to me
> that there is no possible way for anyone to reference whatever it was in
> its previous life.  So the process of morphing ought to be able to do
> any finalization of the old PMC that the GC would do, since the old PMC
> is really and truly going away forever.  In fact, morph *must* finalize;
> since we still have a pointer to the PMC being morphed, the GC won't
> even know that it needs it.  True?

Yep, you are right. I've mixed up referencing a PMC and reusing the PMC
storage. Finalize/destroy has to be done immediately in pmc_reuse(), if
the PMC needs it.o

Which OTOH means that it's possible that arbitrary user code could run
inmidst an assign statement, *if* such a PMC would allow to be reused.

Conclusio:
- morph for scalars is ok: e.g. an Integer transforms itself to a Float
- morph for arbitrary objects must never be done automatically

>                                       -- Bob Rogers

leo

Reply via email to