From: Erik Naggum

Subject: Re: find method with eql-specialized methods

Date: 1998-7-23 5:48

* Shannon Spires
| The simpler original form, (find-method #'foo '() (list '(eql :bar)))
| [typo fixed] works fine in Macintosh Common Lisp, and
| intern-eql-specializer is unknown in MCL.  This unfortunately just means
| one more conditional compilation switch for those of us trying to write
| cross-platform code.  Could find-method be patched in ACL to work the
| simpler way?

(defadvice find-method (eql-specialization :before)
  (loop for arg on (third arglist)
	when (and (consp (car arg))
		  (eq 'eql (caar arg)))
	do (setf (car arg)
	     (clos:intern-eql-specializer (cadar arg)))))

  after this advice has been evaluated (remember to compile it or set
  *COMPILE-ADVICE* non-nil before the DEFADVICE), I get the following:

CL-USER(5): (defmethod foo ((arg (eql :bar))))
#<standard-method foo ((eql :bar))>
CL-USER(6): (find-method #'foo () '((eql :bar)))
#<standard-method foo ((eql :bar))>

  caveat: I still don't know if this is the correct behavior according to
  the specification.  whereas normal specializers take the class name, the
  argument to FIND-METHOD takes the classes, and FIND-CLASS is necessary on
  the usual specializer list.  it is not obvious to me that a list like
  (EQL :BAR) should _not_ undergo a similar transformation in FIND-METHOD.

#:Erik