GENERIC-FUNCTION-NAME is just a reader. The writer implements a different logic, acting via REINITIALIZE-INSTANCE.

This commit is contained in:
Juan Jose Garcia Ripoll 2012-12-03 00:46:56 +01:00
parent 645090b557
commit 93be6ce0b5
3 changed files with 7 additions and 2 deletions

View file

@ -108,7 +108,7 @@
(eval-when (:compile-toplevel :execute)
(defparameter +standard-generic-function-slots+
'((name :initarg :name :initform nil
:accessor generic-function-name)
:reader generic-function-name)
(spec-list :initform nil :accessor generic-function-spec-list)
(method-combination
:initarg :method-combination :initform (find-method-combination (class-prototype (find-class 'standard-generic-function)) 'standard nil)

View file

@ -112,6 +112,11 @@
(setf (fdefinition name) gfun)
gfun)))
(defun (setf generic-function-name) (new-name gf)
(if *clos-booted*
(reinitialize-instance gf :name new-name)
(setf (slot-value gf 'name) new-name)))
(defun default-dispatch (generic-function)
(cond ((null *clos-booted*)
'standard-generic-function)

View file

@ -374,7 +374,7 @@ have disappeared."
;;; early version used during bootstrap
(defun add-method (gf method)
(with-early-accessors (+standard-method-slots+ +standard-generic-function-slots+ +standard-class-slots+)
(let* ((name (generic-function-name gf))
(let* ((name (slot-value gf 'name))
(method-entry (assoc name *early-methods*)))
(unless method-entry
(setq method-entry (list name))