[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
class updating protocol
Here is some pseudo code for the new class updating protocol. This code
tries to take all the comments we got in Boston into account. Please
try to comment on this soon as the rest of the mop re-design depends on
As you read this, some things which are not specifically specified are:
class-access-keys is a generic function which returns the access keys
for a class. This is used to interface to the symbolic access layer.
As we discussed in Boston, there is no longer any reference to index
numbers, instead, access-keys (often symbols) are used to talk
symbolically about the `cells' which standard-instance-access
Also notes that this is based on the instance re-initialization stuff we
sent out in a previous message.
;;;; The class updating protocol.
;;; This is called when a class is reinitialized, and the dependent has
;;; been recorded as one of the dependents of that class. It is supposed
;;; to make sure the dependent class is updated to take the change into
(defmethod update-dependent :around ((reinitialized-class standard-class)
(let ((old-access-keys (class-access-keys dependent)))
(unless (equal old-access-keys (class-access-keys dependent))
;; Implementation specific code to account for the fact that
;; the access keys for this class have changed. This will
;; cause the optimization of standard-instance-access to
;; continue to work.
;; This may include a call to make-instance-obsolete.
(defmethod update-dependent ((reinitialized-class standard-class)
;; When we are called, dependent is finalized since our finalize
;; inheritance method is what recorded us as a dependent. We
;; have to do whatever updating is required to keep us finalized.
;; This includes:
;; - recomputing our class-precedence-list
;; go through the old and new cpls, calling remove-dependent
;; and add-dependent to update our dependents.
;; - recomputing our slots, this may change the value that
;; class-access-keys will be returning.
;; - go through the old and new slots adding and removing
;; automatically generated reader and writer methods as
(defmethod finalize-inheritance ((class standard-class))
;; When we are called, the class is supposed to not be finalized.
;; We are supposed to ensure that it is finalized, that an instance
;; can be created. But sometimes we are called redundantly. First
;; we check to see if we are already finalized, if we are, we do
;; nothing. If we aren't, we set cpl and slots to NIL and then call
;; update-dependent with only two arguments, each of which is the
;; class. Once update dependent returns, we set class-finalized-p
;; of the class to T.
(defmethod reinitialize-instance :before ((class standard-class)
;; unhook old direct-subclass pointers
;;; When this is called, direct-superclasses must be a list of class
;;; objects, direct-slots must be a list of slot description objects
;;; and direct options is a list of class options as in defclass.
(defmethod initialize-instance :after ((class standard-class)
;; hook up new direct-subclass pointers
;; Store the values we get passed in the instance.