unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#73505: EIEIO manual out of date, doesn't reflect current functionality
@ 2024-09-26 22:45 zyd via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-09-27  6:59 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: zyd via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-26 22:45 UTC (permalink / raw)
  To: 73505

Hi,

The info manual for EIEIO seems to be out of date, specifically the introduction
section:

    (info "(eieio) Introduction")

Therein it's stated that EIEIO lacks support for both eql specializers and
`:around' methods


> EQL specialization
>    EIEIO does not support it.
> 
> ‘:around’ method tag
>      This CLOS method tag is non-functional.


But this isn't true at all, EIEIO has both of these features fully functional in
fact. 

-------------------------------------------------------------------------------

(cl-defgeneric inform-chat (msg preamble))

(cl-defmethod inform-chat (msg (preamble (eql :night)))
  (message "Good night chat, %s" msg))

(cl-defmethod inform-chat (msg (preamble (eql :morning)))
  (message "Good morning chat, %s" msg))

(inform-chat "that's all she wrote. What more do you want from me?" :night)
;; => "Good night chat, that's all she wrote. What more do you want from me?"

(inform-chat "many mornings such as this one, today is different! Today is the day I tell you all my hot takes." :morning)
;; => "Good morning chat, many mornings such as this one, but today is the day I
;; tell you all my hot takes."

(cl-defmethod inform-chat :around (msg (preamble (eql :morning)))
  (setq msg (concat "even though there are " msg " Now I know, I know... you're sick of them but I must. I'm compelled, even!"))
  (cl-call-next-method msg preamble))

(inform-chat "many mornings such as this one, today is different! Today is the day I tell you all my hot takes." :morning)
;; => "Good morning chat, even though there are many mornings such as this one,
;; today is different! Today is the day I tell you all my hot takes. Now I know,
;; I know... you're sick of them but I must. I'm compelled, even!"

-------------------------------------------------------------------------------

So I wonder, how much of the rest of the manual is out of date like this? Is it
not to be trusted as a source of factual information about the current state of
CLOS in elisp?

Emacs version: 30.0.60 (commit 1154d8aafe2f4702b8fc775835f830fd00cfbaaf)

-zyd





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-09-27 14:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-26 22:45 bug#73505: EIEIO manual out of date, doesn't reflect current functionality zyd via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-27  6:59 ` Eli Zaretskii
2024-09-27  8:08   ` zyd via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-27 12:48   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-27 13:01     ` Eli Zaretskii
2024-09-27 13:15     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-27 13:23       ` Eli Zaretskii
2024-09-27 14:35         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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).