GNU bug report logs - #38365
26.3; The info doc of eieio-class-name is outdated and its value looks incorrect

Previous Next

Package: emacs;

Reported by: Xu Chunyang <xuchunyang56 <at> gmail.com>

Date: Mon, 25 Nov 2019 21:33:37 UTC

Severity: minor

Tags: fixed

Merged with 38374

Found in version 26.3

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 38365 in the body.
You can then email your comments to 38365 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#38365; Package emacs. (Mon, 25 Nov 2019 21:33:37 GMT) Full text and rfc822 format available.

Acknowledgement sent to Xu Chunyang <xuchunyang56 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 25 Nov 2019 21:33:37 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Xu Chunyang <xuchunyang56 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.3; The info doc of eieio-class-name is outdated and its value
 looks incorrect
Date: Sun, 24 Nov 2019 23:11:10 +0800
(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.




Merged 38365 38374. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 25 Nov 2019 23:06:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38365; Package emacs. (Tue, 26 Nov 2019 01:35:01 GMT) Full text and rfc822 format available.

Message #10 received at 38365 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Xu Chunyang <xuchunyang56 <at> gmail.com>
Cc: 38365 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: 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
Xu Chunyang <xuchunyang56 <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38365; Package emacs. (Tue, 26 Nov 2019 20:45:02 GMT) Full text and rfc822 format available.

Message #13 received at 38365 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 38365 <at> debbugs.gnu.org, Xu Chunyang <xuchunyang56 <at> gmail.com>
Subject: Re: bug#38365: 26.3; The info doc of eieio-class-name is outdated
 and its value looks incorrect
Date: Tue, 26 Nov 2019 15:44:38 -0500
>> 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.

FWIW, here a class's name is indeed a symbol: the "not a name" version
would be the class object itself (a struct).


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38365; Package emacs. (Wed, 27 Nov 2019 12:14:02 GMT) Full text and rfc822 format available.

Message #16 received at 38365 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 38365 <at> debbugs.gnu.org, Xu Chunyang <xuchunyang56 <at> gmail.com>
Subject: Re: bug#38365: 26.3; The info doc of eieio-class-name is outdated
 and its value looks incorrect
Date: Wed, 27 Nov 2019 13:13:37 +0100
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>>> 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.
>
> FWIW, here a class's name is indeed a symbol: the "not a name" version
> would be the class object itself (a struct).

I've now updated the manual to say what it really returns now, but it's
not a very useful function.  :-)  (I mean, it just returns its argument.)

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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 27 Nov 2019 12:14:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 38365 <at> debbugs.gnu.org and Xu Chunyang <xuchunyang56 <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 27 Nov 2019 12:14:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38365; Package emacs. (Wed, 27 Nov 2019 13:53:01 GMT) Full text and rfc822 format available.

Message #23 received at 38365 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 38365 <at> debbugs.gnu.org, Xu Chunyang <xuchunyang56 <at> gmail.com>
Subject: Re: bug#38365: 26.3; The info doc of eieio-class-name is outdated
 and its value looks incorrect
Date: Wed, 27 Nov 2019 08:52:33 -0500
> I've now updated the manual to say what it really returns now, but it's
> not a very useful function.  :-)  (I mean, it just returns its argument.)

It returns its argument only if its argument was a class name.
It's more useful when its argument is a class object (or when you don't
know which of the two it will be).


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38365; Package emacs. (Wed, 27 Nov 2019 13:56:01 GMT) Full text and rfc822 format available.

Message #26 received at 38365 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 38365 <at> debbugs.gnu.org, Xu Chunyang <xuchunyang56 <at> gmail.com>
Subject: Re: bug#38365: 26.3; The info doc of eieio-class-name is outdated
 and its value looks incorrect
Date: Wed, 27 Nov 2019 14:55:00 +0100
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> I've now updated the manual to say what it really returns now, but it's
>> not a very useful function.  :-)  (I mean, it just returns its argument.)
>
> It returns its argument only if its argument was a class name.
> It's more useful when its argument is a class object (or when you don't
> know which of the two it will be).

(eieio-class-name (make-instance 'my-class))
=>
Debugger entered--Lisp error: (wrong-type-argument eieio--class #<my-class my-class-158f4e54cbbc> class)
  signal(wrong-type-argument (eieio--class #<my-class my-class-158f4e54cbbc> class))
  eieio-class-name(#<my-class my-class-158f4e54cbbc>)
  eval((eieio-class-name (make-instance 'my-class)) t)

On the other hand:

(eieio-object-class-name (make-instance 'my-class))
=> my-class

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38365; Package emacs. (Wed, 27 Nov 2019 13:58:01 GMT) Full text and rfc822 format available.

Message #29 received at 38365 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 38365 <at> debbugs.gnu.org, Xu Chunyang <xuchunyang56 <at> gmail.com>
Subject: Re: bug#38365: 26.3; The info doc of eieio-class-name is outdated
 and its value looks incorrect
Date: Wed, 27 Nov 2019 14:57:03 +0100
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> It returns its argument only if its argument was a class name.
> It's more useful when its argument is a class object (or when you don't
> know which of the two it will be).

Oh, class object, not object.  Never mind.  :-)

(eieio-class-name (eieio--class-object 'my-class))
=> my-class

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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 26 Dec 2019 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 173 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.