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

2 problems with add-lexical-functions-to-method-lambda



;;; -*- Package: PCL -*-
In PCL 8/2/88:
Two problems with ADD-LEXICAL-FUNCTIONS-TO-METHOD-LAMBDA:

1.  &AUX variables are not handled properly in the second COND clause:

(macroexpand '(defmethod method-1 ((a c) &aux l)
		(setq l (list a))
		(call-next-method)
		(print l)))

(TOP-LEVEL-FORM
  (METHOD METHOD-1 (C))
  (COMPILE LOAD EVAL)
  (PROGN
    (PROGN					; EXTRA PROGN
      (LOAD-DEFMETHOD
	'STANDARD-METHOD 'METHOD-1 'NIL '(C) '(A &AUX L) 'NIL 'NIL
	'(:NEEDS-NEXT-METHODS-P T)
	#'(LAMBDA (#:A &AUX L)
	    (LET ((.NEXT-METHOD. (CAR *NEXT-METHODS*))
		  (*NEXT-METHODS* (CDR *NEXT-METHODS*)))
	      (FLET ((CALL-NEXT-METHOD (&REST CNM-ARGS)
		       (IF CNM-ARGS (APPLY .NEXT-METHOD. CNM-ARGS)
			   (FUNCALL .NEXT-METHOD. #:A &AUX L)))) ; WRONG
		(LET ((A #:A)
		      (L L))
		  (DECLARE (CLASS A C))
		  (PROGN A)
		  (BLOCK METHOD-1
		    (SETQ L (LIST A))
		    (CALL-NEXT-METHOD)
		    (PRINT L))))))))))

2.  Only the first cond clause generates a CALL-NEXT-METHOD that
errors if there is no next method.  The others simply FUNCALL NIL.
For example macroexpand these 2 cases:

(defmethod method-1 ((a c))			; Errors correctly
  (call-next-method a))

(defmethod method-1 ((a c))			; Funcalls NIL
  (call-next-method))