slime-doc-contribs icon indicating copy to clipboard operation
slime-doc-contribs copied to clipboard

Listing class methods?

Open vindarel opened this issue 3 years ago • 5 comments
trafficstars

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?

vindarel avatar Jun 06 '22 11:06 vindarel

Yes. I see there's something not quite right there. I'll try to change.

mmontone avatar Jun 06 '22 12:06 mmontone

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 ?

mmontone avatar Jun 06 '22 12:06 mmontone

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.

mmontone avatar Jun 07 '22 13:06 mmontone

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.

vindarel avatar Jun 07 '22 14:06 vindarel

Yes, but I don't know what this is:

(defmethod footest () :arg)

mmontone avatar Jun 07 '22 17:06 mmontone