[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Any plans for a finalize-instance method?

   From: eero@newton.arc.nasa.gov (Eero Simoncelli)

   Are there any plans to incorporate a "finalize-instance" method
   (complementing the initialize-instance method) in the CLOS spec?  This
   method would be called after the instance was orphaned (i.e.  all
   references destroyed), but before it was garbage-collected.
   Obviously, this requires an implementation-dependent hook into the
   garbage-collection process.  This would allow cleanup of allocated
   foreign or system structures, static data resources, etc.

Franz's 4.0 release will provide object finalization, as do some other
implementations, but I doubt X3J13 would agree to require it in the
language spec on two grounds: First, some existing implementations
might not be able to provide finalization.  The "guidelines" under
which X3J13 chose to work are require in lieu of compelling reasons,
no languages changes would be adopted that would present
insurmountable difficulties for existing implementations.  (For
example, the features tagged and untagged hardware find easy and
difficult are sometimes quite different.)  Second, requiring
finalization might preclude novel future gc strategies, and it would
be contrary to a standardization effort to require features with
uncertain implications for future development.

By the way, I see no reason to limit finalization to standard
instances.  It can be defined over all non-immediate objects (i.e.,
approximately those objects which cannot be identity checked by #'eq.)