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

Multiple EQL specializers bug


PCL system date: 5/22/89  Victoria Day PCL
Lisp Implementation type: Lucid Common Lisp
Lisp Implementation version: 3.0.2

there appears to be a bug when multiple EQL specializers are used; if
there is a method with more than 1 EQL specializers, then the other
methods (for the same generic function) with less EQL specializers
can't be found.

Try the following program:

(defclass class-1


(defmethod hello1 ((object class-1) (arg1 (eql 'a)))
   (format t "Hello1 from (class-1 'a)~%")

(defmethod hello1 ((object class-1) arg1)
   (format t "Hello1 from (class-1 T)~%")

(defmethod hello2 ((object class-1) (arg1 (eql 'a)) (arg2 (eql 'b)))
   (format t "Hello2 from (class-1 'a 'b)~%")

(defmethod hello2 ((object class-1) (arg1 (eql 'a)) arg2)
   (format t "Hello2 from (class-1 'a T)~%")

(setq o1 (make-instance 'class-1))

(hello1 o1 'a)
(hello1 o1 'c)
(hello2 o1 'a 'b)
(hello2 o1 'a 'c)

You will find that the last line fails.
I tried changing the order of evaluation, e.g. calling (hello2 o1 'a 'c)
before defining the method specialized on 'b and it works
Hence my conclusion; as soon as a second EQL specializer is used, the
non-specialized method goes poof!

Or am I doing something forbidden?


Martin Boyer
McGill Research Centre for Intelligent Machines
McGill University, Montreal, QC