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

changing &key/&rest in generic function lambda lists



I noticed this weird behavior in MayDay R2 PCL on a 3600 running rel 7.2.
I not (yet) on the list so excuse me if this has been brought up before.

;;; -*- Mode: LISP; Syntax: Common-Lisp; Package: (FOO :USE (LISP PCL)); Base: 10 -*-

;;;; The defgeneric/defmethod arglist processor sometimes gets wedged if
;;;; I change the arglist of a generic function.

(defclass random1 () ())

;;; Define a method...

(defgeneric random-function ((foo random1))
  )

;;; Do something stupid...

(defmethod random-function ((foo random1) &key bar)
  t)

;;; Fix it (ie recompile)

(defgeneric random-function ((foo random1) &rest rest-args)
  )

;;; This still breaks...

(defmethod random-function ((foo random1) &key bar)
  t)

;;; Yet when we do it right the first time...

(defclass random2 () ())

(defgeneric random2-function ((foo random2) &rest keyword-args)
  )

;;; It compiles with no problem...

(defmethod random2-function ((foo random2) &key bar)
  t)

;;; Is this an error?
;;; I also noticed that if I do 
;;; (setf (symbol-function 'random-function) nil)
;;; and recompile the defgeneric form, things work out ok.