Lisp HUG Maillist Archive

keyword as a type to defmethod

Hello all,

I'm taking a look at the Wilbur SW toolkit (which someone mentioned
not too long ago:
http://article.gmane.org/gmane.lisp.lispworks.general/6757) but as was
discovered in that thread, there is an error in compiling Wilbur.

The compile error I'm getting is:

Keyword is not the name of a class
   [Condition of type Simple-Error]

from the code

(defmethod get-some-values ((frame node) (path keyword) (db db) index)
  ...)

I can get the same kind of error using the following code:

(defmethod foo (sym)
  :not-keyword)

(defmethod foo ((sym keyword))
  :keyword)

I didn't know that keyword was a type, but from:
http://www.lispworks.com/documentation/HyperSpec/Body/11_abc.htm, I
see that "Symbols in the KEYWORD package are, by definition, of type
keyword." The following does work in LispWorks:

(defmethod foo ((x fixnum))
  :fixnum)

Looking through the HyperSpec, and I'm not completely sure, but it
seems like LispWorks is correct in this behavior (since keyword is
just a /type/, whereas, say, symbol is a /system class/.) Can anyone
confirm or deny this?

There seem to only be a couple of these instances in Wilbur, so I'll
work around it for now, but if LispWorks' behavior is right, I'll try
to get a patch off the the Wilbur folks.

Thanks!

-- 
=====================
Joshua Taylor
tayloj@rpi.edu

"A lot of good things went down one time,
     back in the goodle days."
               John Hartford


Re: keyword as a type to defmethod

Hello Joshua,

| The compile error I'm getting is:
|
| Keyword is not the name of a class
|    [Condition of type Simple-Error]
|
| from the code
|
| (defmethod get-some-values ((frame node) (path keyword) (db db) index)
|   ...)
|...snip...|
| (defmethod foo ((x fixnum))
|   :fixnum)
|
| Looking through the HyperSpec, and I'm not completely sure, but it
| seems like LispWorks is correct in this behavior (since keyword is
| just a /type/, whereas, say, symbol is a /system class/.) Can anyone
| confirm or deny this?
|
| There seem to only be a couple of these instances in Wilbur, so I'll
| work around it for now, but if LispWorks' behavior is right, I'll try
| to get a patch off the the Wilbur folks.

I believe that keyword and fixnum are types but not classes in LispWorks. So
LispWorks does the right thing rejecting them as class specifies.
--
Sincerely,
Dmitriy Ivanov
lisp.ystok.ru


Updated at: 2020-12-10 08:45 UTC