[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Getting (eql <eql-specializer-form>) parameters to work
- To: CommonLoops.pa@Xerox.COM
- Subject: Getting (eql <eql-specializer-form>) parameters to work
- From: Darrell <firstname.lastname@example.org>
- Date: Tue, 14 Mar 89 09:55:28 PST
- Cc: Darrell_Shane <email@example.com>
- Redistributed: CommonLoops.pa
Would someone straighten me out on the use of <parameter-specializer-name>'s
of the form (eql <deftype'ed type>)?
Consider the following:
(deftype symbol-string () '(or symbol string))
(deftype non-nil-symbol-string () '(satisfies one-of-them))
(defun one-of-them (x)
(if (and (typep x 'symbol-string) (not (null x))) t nil))
(defmethod meth ((arg (eql 'non-nil-symbol-string)))
(format t "~A is a non-nil symbol or string.~%" arg))
(meth 'asymbol) ==>
Error: No matching method for the generic-function #<Function METH @ #x5f0691>,
when called with arguments (ASYMBOL).
Reading the clos spec., I realize that the above usage of the eql parameter
specializer is incorrect, but its usage seems very limited if the parameter,
arg, must be eql to the value of the parameter specializer form. Is it
legal to have a specializer that is a type, and if so, how? Are eql
parameter-specializer-name's implemented in the 12/7/88 version of pcl?
If they are, how would I declare a method that would agree on a parameter
that is of type non-nil-symbol-string?
P.S. I am using Franz Allegro CL 3.0.1.