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

Alternative Proposal for class updating



     
     The generic functions used are:
     
     Reintialization:
     
     reinitialize-instance (object &rest reinit-args)
     
     This generic function is intended to initialize again the object.  The default
     method augments the given reinit-args using default-initargs, checks the
     arguments, and calls initialize-instance.  It then updates any dependents
     
I like the concept. I would like it to be more parallel to make-instance
though. reinitialize-instance could accept allocate-instance keywords as
well. We can imagine cases where we would want to reallocate the
instance, i.e update the instance allocation characteristics without
affecting the slots. We could re-use the MAKE-INSTANCE  model:

(defmethod reinitialize-instance ((object standard-object) &rest reinitargs)	
   (setq reinitargs (default-initargs (class-of object) reinitargs))
   (check-initargs (class-of object) reinitargs)
   (apply #'reallocate-instance (class-of object ) reinitargs)
   (apply #'intialize-instance object reinitargs))

We also have to tell what happens if a slot is unbound. Do we
reinitialize it to its initform when there is no reinitargs to
reinitialize it?

     method-keyword-arguments (generic-function list-of-arguments)
     
     This generic function provides an facility to help users to write code for
     checking legality of keyword arguments.

Maybe this facility is not necessary for reinitialize-instance?

     Recording dependencies.
     
     add-dependent(object dependent &key)
     remove-dependent(object dependent &key)
     all-dependents(object)
     
     These three generic functions allow the recording of dependencies.  Nothing is
     specified about what the dependencies are.
     
     The real work is done here:
     
     update-dependent(object dependent &key)

Here again, I like the concept. What bothers me is that update-dependent
is not called by make-instance but is called by reinitialize-instance. I
wonder if update-dependent shouldn't be called outside of
reinitialize-instance.

Patrick.