fork()

Graham Matthews graham at sloth.math.uga.edu
Wed Jun 16 17:55:53 CEST 1999


[Hisao Suzuki]
>     Note that it is
>     always important to destroy objects in an order that ensures
>     that the destructor for one object doesn't refer to an
>     object that has been previously destroyed.  Such ordering
>     isn't easily achieved by a garbage collector without help
>     from the programmer."

I think people are confusing implementation with semantics here.
The Java implementation of GC might have the problem of destroying objects
too early, and hence having to deal with objects that refer to
previously destroyed objects. But this is an implementation issue
and not a semantic issue. A two pass collector avoids this problem
completely. In pass 1 all finalisers are called, but no object
deleteion is done. In pass 2 object deletion occurs. The point
is to define what you want for the semantics of finalisation and
then implement it. The Java approach you refer to above is to define
and implementation and make that the semantics. Indeed this is
largely the Python approach (the language semantics is really defined
by the C implementation). For my money semantics by implementation
leads to serious problems.

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