Subject: Re: bug#38365: 26.3; The info doc of eieio-class-name is outdated and its value looks incorrect

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 26 Nov 2019 02:34:48 +0100

Xu Chunyang <[email-masked]> writes:

> (info "(eieio) Predicates") mentions
>
>  -- Function: eieio-class-name class
>      Return a string of the form ‘#<class myclassname>’ which should
>      look similar to other Lisp objects like buffers and processes.
>      Printing a class results only in a symbol.
>
> but it is not right, the value is not string at all, it's a symbol
>
>   (defclass my-class () ())
>   ;; => my-class
>
>   (eieio-class-name 'my-class)
>   ;; => my-class
>
>   (type-of (eieio-class-name 'my-class))
>   ;; => symbol
>
> The git master produced the same result as Emacs 26.3. I notice Emacs
> 24.3's class-name produces the expected result and the function is
> replaced by eieio-class-name since 24.4
>
>    (define-obsolete-function-alias 'class-name #'eieio-class-name "24.4")
>
> however, these two functions are different. It seems eieio-class-name
> contains a bug, the name suggests its value is a string, but it
> returns a symbol.

My guess is that the documentation in the manual just wasn't updated
when this stuff was rewritten back in 2014, and that the return value is
correct.  Stefan?

Currently we have

(defun eieio--class-print-name (class)
  "Return a printed representation of CLASS."
  (format "#<class %s>" (eieio-class-name class)))

(defun eieio-class-name (class)
  "Return a Lisp like symbol name for CLASS."
  (setq class (eieio--class-object class))
  (cl-check-type class eieio--class)
  (eieio--class-name class))
(define-obsolete-function-alias 'class-name #'eieio-class-name "24.4")

but eieio--class-print-name is only used as a fallback in one of the
prin1 cases.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no