[gclist] Buffy finalizer slayer.

Charles Fiterman cef@geodesic.com
Fri, 11 Jun 1999 14:19:48 -0500

At 11:48 AM 6/11/99 -0700, you wrote:
>>If the mutator takes the pointer to the dead object and saves it you must
>>either declare it undead and have a meaning for that state or you have a
>>loose pointer. The greatest value of a strongly typed language like Java is
>>you can't write a virus in it. Once you create a loose pointer you can
>>create a virus. Allocate a 10,000 byte character array in a finalizer
>>object, force the finalizer to run saving a pointer to the object. Now run
>>more stuff waiting for an object to appear in your character array. Now you
>>can corrupt the pointers in the array to execute your hand coded assembler.
>While I agree with you about the usfulness of finalizers, I think that 
>Java doesn't have this problem. The object remains a "real" object until 
>the finalizer finishes running. If the finalizer stores a reference to 
>the object then it (and the transiti9ve closure of the objects it 
>references) remains as live objects until all new references are removed. 
>Then the object is collected. The finalizer is not run a second time.

This declares a meaning for the word undead. An undead object is not
finalized before removal. You've cluttered the semantics of the mutator
with undead objects. Can you cast a spell to resoul an undead object? Do
the resouled undead differ from the living? Can a resouled undead object
lose its soul again and does it differ from other undead objects when that

The entire semantics of the language is cluttered with every new kind of
object and transition you add.

Watching Buffy Vampire Slayer is fun and you run into all these questions.
But the plot twists they create often fall apart. I'm glad that isn't the
real world and I'm thrilled I don't have to work there.