slime-doc-contribs
slime-doc-contribs copied to clipboard
Listing class methods?
Hello dear lisper,
I see that the help buffer for a class has a "methods" entry. I was expecting it to list the class's methods, but it seems to list methods that have the same name of the class.
We just talked on Discord we can get the list of methods with
(defclass footest () ())
(defmethod foo-method ((obj footest)) :yep)
(closer-mop:specializer-direct-methods (find-class 'footest))
If I add
(defmethod footest () :arg)
the help buffer will show footest but not foo-method.
Wouldn't be a great addition?
Yes. I see there's something not quite right there. I'll try to change.
I'm having trouble with your example.
Current implementation uses swank-backend:who-specializes. I could change to closer-mop, blindly, but I would like to understand the problem better.
FOO-TEST> (closer-mop:specializer-direct-methods (find-class 'footest))
(#<STANDARD-METHOD FOO-TEST:FOO-METHOD (FOOTEST) {1006FAE3A3}>)
FOO-TEST> (swank-backend:who-specializes (find-class 'footest))
(((DEFMETHOD FOO-METHOD)
(:ERROR
"Error: DEFINITION-SOURCE of function (METHOD FOO-METHOD) did not contain meaningful information.")))
Can you help me with an example where swank-backend:who-specializes and closer-mop:specializer-direct-methods differ ?
I see that the help buffer for a class has a "methods" entry. I was expecting it to list the class's methods, but it seems to list methods that have the same name of the class.
Also note that only exported symbols are listed only atm.
Strange, I don't have your error with swank-backend, it works too.
(swank-backend:who-specializes (find-class 'footest))
(((DEFMETHOD FOO-METHOD)
(:LOCATION
(:BUFFER-AND-FILE "cmdcollectivites.lisp"
"/home/vince/projets/foo/src/cmdcollectivites.lisp")
(:OFFSET 18381 0) (:SNIPPET "(defmethod foo-method ((obj footest)) :yep)"))))
Did you write my example class and method on the REPL? I wrote them in a file.
Yes, but I don't know what this is:
(defmethod footest () :arg)