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

Re: Compilation implications



    Date: Thu, 5 Jan 89  11:50:25 CST
    From: David N Gray <Gray@DSG.csc.ti.com>

    (defclass fasdump-mixin ....

    While this works, 

For classes where simply saving the values of the slots is enough to save
all relevant state of the object, and where simply restoring equivalent
values into the slots and not calling make-instance, initialize-instance,
nor shared-initialize is enough to create an equivalent object.  Such
classes do exist, so this is worth telling people how to do so they can
use it with such classes.

		      I don't think this is an ideal solution because it
    doesn't handle the case of recursive data structures.  A better solution
    might be something along the lines of having the generic function return
    four values:
      1. The class name.
      2. A list of additional arguments for ALLOCATE-INSTANCE.
      3. The name of an initialization function.
      4. Initialization arguments.
    The loader would then first do 
      (APPLY #'ALLOCATE-INSTANCE (FIND-CLASS class-name) other-allocate-args)
    to create the object before it begins reading the next two items, and then
    finally do 
      (APPLY (SYMBOL-FUNCTION init-function) the-object initialization-args)
    to fill in the slots.

You can make your REMAKE-OBJECT technique do this without modifying the loader
(you have to put in a special variable that allows you to detect recursive
calls).  Or did you want to do the final step at some later time than when
the outermost in a set of nested objects is created?  I don't think deferring
the final step until the end of loading the file would work in many cases.