[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: common-lisp-object-system@SAIL.STANFORD.EDU
- Subject: reinitialization protocol
- From: Gregor.pa@Xerox.COM
- Date: Thu, 28 Jan 88 11:45 PST
- Fcc: BD:>Gregor>mail>outgoing-mail-1.text
- Line-fold: no
Here is some pseudo code for the re-initialization protocol that Danny
and I worked out.
;;;; The re-initialization protocol.
(defmethod reinitialize-instance ((object standard-object) &rest reinit-args)
(let* ((arglist (list object))
(method-keyword-arguments #'initialize-instance arglist)
(method-keyword-arguments #'reinitialize-instance arglist)
(class-all-slot-initargs (class-of object)))))
;; check the keyword arguments
(zl:loop (key in reinit-args by cddr)
(or (member key acceptable-args) (error ...)))
;; now initialize the instance
(apply #'initialize-instance object
(default-init-args object reinit-args))
;; update all dependents
(loop (dep in (all-dependents object))
(apply #'update-dependent object dependent reinit-args))
;;; Generic functions for managing the dependents of an object. This is
;;; part of the instance re-initialization protocol. How dependents are
;;; stored is implementation dependent. Some subclasses of
;;; standard-object which know that they are in fact going to have lots
;;; of dependents may want to replace this triad of methods with methods
;;; which actually store the value in a slot.
(defmethod add-dependent ((object standard-object)
;; Add dependent as a dependent of object.
(defmethod remove-dependent ((object standard-object)
;; Remove dependent as a dependent of object.
(defmethod all-dependents ((object standard-object))
;; Returns the list of all dependents of the object.