Re: defgeneric problem

Gary Byers <[email protected]> Mon, 20 Jan 2003 16:14:04 -0700 (MST)
Newsgroups gmane.lisp.openmcl.bugs
Message-ID <[email protected]>

On Mon, 20 Jan 2003, james anderson wrote:

> fwiw

In "ccl:lib;misc.lisp" we have:

(defmethod (setf documentation) ((new t) (f function) (doc-type (eql 't)))
  (setf (documentation f 'function) new))

; and ...
(defmethod (setf documentation) ((new t)
                                 (f function)
                                 (doc-type (eql 'function)))
  (setf (documentation f t) new))

which pretty clearly explains the recursion.

This is obviously pretty stupid.

Redefining the former of these methods seems to break the recursion:

Welcome to OpenMCL Version (Beta: Darwin) 0.13.3!
? (let* ((ccl:*warn-if-redefine-kernel* nil))
  (defmethod (setf documentation) ((new t) (f function) (doc-type (eql t)))
    (call-next-method)))
#<STANDARD-METHOD (SETF DOCUMENTATION) (T FUNCTION (EQL T))>
? (defGeneric initialize-clone (node clone)
   (:documentation
    "copy slot values from one node to another.
     slots with bound values are left unchanged in order to permit
previous initarg based
     initialization (see clone-instance), which can then avoid unwanted
deep cloning.")
   (:method-combination progn :most-specific-first)
   (:method progn ((from standard-object) (to standard-object))))

#<STANDARD-GENERIC-FUNCTION INITIALIZE-CLONE #x52A656E>
?

I'm not sure at the moment whether this is a new bug or an old one
that was just exposed by the change to enable doc-string recording;
I tend to suspect that it's new.