Solution to finalisation problem [Re: fork()]

Graham Matthews graham at sloth.math.uga.edu
Mon Jun 14 15:58:40 EDT 1999


[Greg Ewing]
> Indeed, which leads me to believe that the idea of giving objects
> a __del__ method is fundamentally flawed in the first place.
Tim Peters (tim_one at email.msn.com) wrote:
: Except it works so nice in "the usual" case (no cycle, no resurrection):
: everyone agrees on what should be done then, and it's remarkably
: surprise-free!

The problem with this argument Tim is that is is very difficult for the
programmer to recognise when they are in "the usual case", since circular
references are easy to create. Hence it is very difficult for the 
programmer to verify the correctness of their code.

Tim Peters (tim_one at email.msn.com) wrote:
: It's cycles that break its back, in Python and Java:

No cycles are not the problem. The problem is that finalisers are run in
"incomplete contexts". These incomplete contexts arise because implementations
of GC delete or partially delete collected objects before calling finalisers. 
That is a mistake. If you run *all* finalisers of *all* collected objects 
before you actually delete or partially delete any of those objects then 
all finalisers run in well defined contexts and there are no problems
with finalisers. That is the point of two pass collection.

graham
-- 
           As you grow up and leave the playground
       where you kissed your prince and found your frog
          Remember the jester that showed you tears
                   the script for tears




More information about the Python-list mailing list