unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Xu Chunyang <xuchunyang56@gmail.com>
Cc: 38365@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#38365: 26.3; The info doc of eieio-class-name is outdated and its value looks incorrect
Date: Tue, 26 Nov 2019 02:34:48 +0100	[thread overview]
Message-ID: <87o8wzifnr.fsf@gnus.org> (raw)
In-Reply-To: <CABCqdB=TaAbCNfDUtja=RBvUWOk+mApWkyVSG8Un7Q9s0WYfWw@mail.gmail.com> (Xu Chunyang's message of "Sun, 24 Nov 2019 23:11:10 +0800")

Xu Chunyang <xuchunyang56@gmail.com> 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





  parent reply	other threads:[~2019-11-26  1:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-24 15:11 bug#38365: 26.3; The info doc of eieio-class-name is outdated and its value looks incorrect Xu Chunyang
2019-11-25 17:08 ` bug#38374: " Xu Chunyang
2019-11-26  1:34 ` Lars Ingebrigtsen [this message]
2019-11-26 20:44   ` bug#38365: " Stefan Monnier
2019-11-27 12:13     ` Lars Ingebrigtsen
2019-11-27 13:52       ` Stefan Monnier
2019-11-27 13:55         ` Lars Ingebrigtsen
2019-11-27 13:57         ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o8wzifnr.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=38365@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=xuchunyang56@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).