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

Bugs we have found in MayDay PCL



1.  The code which constructs the dispatch functions for generic functions
    doesn't work for EQL methods.  This is especially surprising since EQL
    methods did work in some earlier version of PCL.

2.  :AROUND methods for generic functions which take optional arguments get
    rewritten under Genera into methods which cannot be loaded because PCL
    claims the argument lists are not congruent.  For example,

    (defclass test () ((test-list :initform nil)))

    (defmethod test-one ((test test) &optional test-p)
      (declare (ignore test-p))
      (null test))

    (defmethod test-one :around ((test test) &optional test-p)
      (declare (ignore test-p))
      (or (null *standard-output*)
	  (call-next-method)))
Error: Attempt to add the method #<Standard-Method NIL :AROUND (TEST) 104200047> 
       to the generic function #<Standard-Generic-Function TEST-ONE (1) 64405170>.
       But the method has "fewer" optional arguments than the generic function.

This happens because the second method is rewritten as follows:

   (DEFUN (PCL:METHOD TEST-ONE :AROUND (TEST)) (#:TEST &REST #:AMPERSAND-ARGS)
     ...)

which appears not to be congruent to the other method definition.

A patch for this problem appears at the end of this message.

3.  PCL uses some of the parameters to methods, and doesn't bother to
    remove the IGNORE declarations for those parameters:

    (defmethod test-two ((test test) thing1 thing2)
	(declare (ignore thing2))
	(push thing1 (slot-value test 'test-list)))
For Function (PCL:METHOD TEST-TWO (TEST T T))
  While compiling THING2:
    The ignored variable THING2 was referenced.

-----------------------------------------------------------------

Patch for the lambda-list congruence bug:

;=====================================
(SYSTEM-INTERNALS:BEGIN-PATCH-SECTION)
(SYSTEM-INTERNALS:PATCH-SECTION-SOURCE-FILE "PCL:MAY-DAY-PCL;GENERA-LOW.LISP.2")
(SYSTEM-INTERNALS:PATCH-SECTION-ATTRIBUTES
  "-*- Mode:LISP; Package:(PCL Lisp 1000); Base:10.; Syntax:Common-lisp; Patch-File: Yes -*-")

(defun pcl-fdefine-helper (gspec qualifiers specializers fn)
  (let* ((dlist (scl:debugging-info fn))
	 (class (cadr (assoc 'pcl-method-class dlist)))
	 (doc (cadr (assoc 'pcl-documentation dlist)))
	 (lambda-list (let ((ll-stuff (assoc 'pcl-lambda-list dlist)))
			(if ll-stuff (cadr ll-stuff) (arglist fn))))
	 (plist (cadr (assoc 'pcl-plist dlist))))
    (load-defmethod (or class 'standard-method)
		    gspec
		    qualifiers
		    specializers
		    lambda-list
		    doc
		    (getf plist :isl-cache-symbol)
		    plist
		    fn)))

-----------------------------------------------------------------