docstrings for accessor methods default to docstring of slot from specialized class affects cl:describe cl:documentation

Bug #902259 reported by mon_key
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
New
Undecided
Unassigned

Bug Description

CL:DESCRIBE return value around accessor methods specialized on a class pick up
the slots docstring (if present) -- why would the documentation for the class'
slot neccesarily be relevant to the accessor method?
SBCL 1.0.47.1 to 1.0.51.x

(defgeneric tt--foo (object)
  (:documentation "generic docstring"))
;=> #<STANDARD-GENERIC-FUNCTION TT--FOO (1)>

(defgeneric (setf tt--foo) (value object)
  (:documentation "setf generic docstring"))
;=> #<STANDARD-GENERIC-FUNCTION (SETF TT--FOO) (1)>

(defclass tt--foo-class ()
  ((tt--foo
    :accessor tt--foo
    :documentation "slot docstring" )))
;=> #<STANDARD-CLASS TT--FOO-CLASS>

(describe 'tt--foo)

=> | COMMON-LISP-USER::TT--FOO
   | [symbol]
   |
   | TT--FOO names a generic function:
   | Lambda-list: (OBJECT)
   | Derived type: (FUNCTION (T) *)
   | Documentation:
   | generic docstring
   | Method-combination: STANDARD
   | Methods:
   | (TT--FOO (TT--FOO-CLASS))
   | Documentation:
   | slot docstring
   | Source file: SYS:SRC;PCL;DFUN.LISP.NEWEST
   |
   | (SETF TT--FOO) names a generic function:
   | Lambda-list: (VALUE OBJECT)
   | Derived type: (FUNCTION (T T) *)
   | Documentation:
   | setf generic docstring
   | Method-combination: STANDARD
   | Methods:
   | ((SETF TT--FOO) (T TT--FOO-CLASS))
   | Documentation:
   | slot docstring
   | Source file: SYS:SRC;PCL;DFUN.LISP.NEWEST

I would expect the docstrings for specialized methods to be null unless
specifically provided.

(documentation (find-method #'tt--foo nil '(tt--foo-class)) t)
;=> "slot docstring"

(documentation (find-method (function (setf tt--foo)) nil '(t tt--foo-class)) t)
;=> "slot docstring"

(setf (documentation (find-method (function (setf tt--foo)) nil '(t tt--foo-class)) t)
      "docstring for (setf #'tt--foo) - not slot docstring for the class tt--foo")
;=> "docstring for (setf #'tt--foo) - not slot docstring for the class tt--foo"

(setf (documentation (find-method #'tt--foo nil '(tt--foo-class)) t)
      "docstring for method #'tt--foo - not slot docstring for the class tt--foo")
;=> "docstring for method #'tt--foo - not slot docstring for the class tt--foo"

(documentation (find-method #'tt--foo nil '(tt--foo-class)) t)
;=> "docstring for method #'tt--foo - not slot docstring for the class tt--foo"

(documentation (find-method (function (setf tt--foo)) nil '(t tt--foo-class)) t)
;=> "docstring for (setf #'tt--foo) - not slot docstring for the class tt--foo"

(documentation #'tt--foo 'function)
;=> "generic docstring"

(describe 'tt--foo)
=> | COMMON-LISP-USER::TT--FOO
   | [symbol]
   |
   | TT--FOO names a generic function:
   | Lambda-list: (OBJECT)
   | Derived type: (FUNCTION (T) *)
   | Documentation:
   | generic docstring
   | Method-combination: STANDARD
   | Methods:
   | (TT--FOO (TT--FOO-CLASS))
   | Documentation:
   | docstring for method #'tt--foo - not slot docstring for the class tt--foo
   | Source file: SYS:SRC;PCL;DFUN.LISP.NEWEST
   |
   | (SETF TT--FOO) names a generic function:
   | Lambda-list: (VALUE OBJECT)
   | Derived type: (FUNCTION (T T) *)
   | Documentation:
   | setf generic docstring
   | Method-combination: STANDARD
   | Methods:
   | ((SETF TT--FOO) (T TT--FOO-CLASS))
   | Documentation:
   | docstring for (setf #'tt--foo) - not slot docstring for the class tt--foo
   | Source file: SYS:SRC;PCL;DFUN.LISP.NEWEST

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.