On Thu, Dec 07, 2000 at 11:24:06AM -0500, Dan Sugalski wrote:
> I think I'd just as soon always call DESTROY in a predicable manner and not
> do *anything* perlish at GC time. If nothing else it means that we don't
> have to worry about having a valid perl context handy when the GC runs.
> (Since threading the thing is a possibility we might run into issues otherwise)
I *think* that provides solutions for almost all of the problems where
DESTROY is used. I believe that most things either want
1: Run this code before freeing the memory
2: Run this code as soon as the last reference disappears
note "before" not necessarily "immediately before"
but most problems don't need
a: Free the memory as soon as the last reference disappears
and most problems don't want a SMITE method
(ie destroy the thing even if this isn't the last reference, and turn any
other references to it to dust (or undef))
SMITE is hard work if you're not omniscient, as you have to go round
searching for everyone who might refer to it, or fake it by holding
a back reference to everyone who references you.
Nicholas Clark