mgl-pax icon indicating copy to clipboard operation
mgl-pax copied to clipboard

slot's using default generic functions

Open rabbibotton opened this issue 3 years ago • 2 comments

It would be great if slot's using default generic functions would pull documentation from the slot definition when listed as generic-function in the defsection.

rabbibotton avatar Feb 25 '22 03:02 rabbibotton

So the problem is that when using the generic-function locative instead of e.g. reader the docstring is not found.

(defclass xxx ()
  ((a :reader xxx-a :documentation "This is XXX-A.")))

(pax:document (pax:locate 'xxx-a '(pax:reader xxx)))
.. - [reader] XXX-A XXX
..
..     This is XXX-A.
..

(pax:document (pax:locate 'xxx-a 'generic-function))
.. - [generic-function] XXX-A OBJECT
..

I guess you consider the choice between having a reader or a separate generic function an implementation detail and would not like to expose readerness in the documentation, right?

melisgl avatar Feb 25 '22 08:02 melisgl

Whoops, I meant to use the method locative.

(pax:document (pax:locate 'xxx-a '(method () (xxx))))
.. - [method] XXX-A (XXX XXX)
..
..     This is XXX-A.
..

It seems to work as intended. The problem with using generic-function is that there can be multiple classes, each with its own reader (with the same name), so there is no single docstring which shall be presented.

melisgl avatar Feb 25 '22 08:02 melisgl

Closing. Feel free to reopen if my reasoning above is incorrect.

melisgl avatar Apr 23 '23 12:04 melisgl