[gclist] Buffy finalizer slayer.

Charles Fiterman cef@geodesic.com
Tue, 15 Jun 1999 13:34:19 -0500

At 02:02 PM 6/15/99 -0400, you wrote:
>I think that Java called it about right; by being explicit in
>the spec about:
>1. it runs only once per object

This introduces at least a second class of object and requires a
reflects_in_mirror() method so you can tell what kind of object you have. I
find it objectionable and pointless. Some trivial implementation detail
made this easy and they raised it to the level of a standard without
thinking about it.

>2. in no particular order

I agree. If there is order the user can acheive it by intelligently
factoring objects. The trick is to allow finalization to be turned off or
on. Suppose you have file objects which are opaque to the user and the user
wants to add a buffer object. The buffer object has a finalizer that runs
the file object's finalizer. Now the user simply has to say "Don't run the
file object's finalizer."

>3. eventually, maybe

This is seriously wrong. The user needs a way to deal with unrun finalizers
at end of job or at will.

I think semi tame finalizers would require.

1. Finalizers run a method named finalize() but anything can run that method.

2. A finalizer is a leaf object with a pointer an object to finalize.
Running the finalizer destroys the object but you can make another one and
you can destroy it yourself.

3. A way to test an object for the existence of a connected finalizer.

4. A way to traverse finalizers on objects of a given class. 

But following the Buffy thread this doesn't allow complete satisfaction. I
wouldn't go to bed with one.

Charles Fiterman		     Geodesic Systems
414 North Orleans Suite 410	     Phone 312 832 2015
Chicago IL 60610-4418              FAX   312 832 1230

Every software project is late. Y2K will be done in 2020.