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

Re: parameter specializer (eql object) -- I'm confused



Subject: parameter specializer (eql object) -- I'm confused
From: Paul Shannon, pshannon@iapetus.cv.nrao.edu
Date: Tue, 21 Jun 1994 01:12:19 GMT
In article <PSHANNON.94Jun20211219@iapetus.cv.nrao.edu> Paul Shannon, pshannon@iapetus.cv.nrao.edu writes:
>I would like to be able to specialize a method on the value of
>an object, like this:
>
>    (defmethod dispatch ((eql "Save"))
>       ...)
>
>I can't get this to work under Macintosh Common Lisp (2.0.1)
>Specifically:
>
>(defmethod dispatch-callback ((eql "Apple") (eql "Save"))
>  (format t "dispatch-callback:  apple, save~%"))
>
>Error: Illegal arg "Apple"
>
>I guess I've misconstrued this kind of parameter specializer.  Keene's
>book (as far as I can tell) doesn't present examples.  
>
>Any advice?
>
>Thanks.
>
> - Paul Shannon
>   pshannon@nrao.edu
>   National Radio Astronomy Observatory
>   Charlottesville, Virginia
>
>
The syntax is like this

(defmethod dispatch-callback ((var1 (eql "Apple")) 
	                          (var2 (eql "Save")))
 (format t "dispatch-callback:  apple, save~%"))
 
 but this won't work anyway because you need 'equal' for strings not 'eql'

 What effect are you trying to get? What do the other methods look like for this function?
---------------------------
Alexander Clark
asc@aclark.demon.co.uk
---------------------------