From: Shannon V Spires

Subject: Re: find method with eql-specialized methods

Date: 1998-7-23 2:17

> From: Steve Haflich < at smh> > > From: Stefan Landvogt < at stefan> > > I have the following methods > > (defmethod foo (arg)) > (defmethod foo ((arg integer))) > (defmethod foo ((what (eql :bar)))) > > USER(58): (find-method #'foo '() `( (eql :bla))) > Error: The generic function #<STANDARD-GENERIC-FUNCTION FOO> does not > have a method > with qualifiers NIL specializers ((EQL :BLA)) > [condition type: PROGRAM-ERROR] > [1] USER(59): > > What is the right thing to do here? > > Two problems: > > First, you misspelled :BAR as :BLA, but even after correcting that it > still won't work. Manipulation of EQL specializers is not covered in > the ANS but is specified in the AMOP (see Appendix B in the ACL User > Guide). > > The third argument to FIND-METHOD is a list of CLOS:SPECIALIZER > objects. A CLASS is a CLOS:SPECIALIZER, and so is a > CLOS:EQL-SPECIALIZER. You obtain a CLOS:EQL-SPECIALIZER for an object > with the function CLOS:INTERN-EQL-SPECIALIZER. > > USER(7): (find-method #'foo () (list (clos:intern-eql-specializer :bar))) > #<STANDARD-METHOD FOO ((EQL :BAR))>
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? Shannon Spires < at svspire>