unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: zyd via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 73505@debbugs.gnu.org
Subject: bug#73505: EIEIO manual out of date, doesn't reflect current functionality
Date: Thu, 26 Sep 2024 22:45:27 +0000	[thread overview]
Message-ID: <93_8XMSOOu0_kIfElCZTcNDPXyZ0rUh6CXkKtDd-CGAYsSFXcWMggsZyqtlqrYmDQOVMziu5T8CIQ4zL0VrnpKVl85vZ4pCE-cXyL3rHL9Q=@proton.me> (raw)

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





             reply	other threads:[~2024-09-26 22:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-26 22:45 zyd via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-09-27  6:59 ` bug#73505: EIEIO manual out of date, doesn't reflect current functionality 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

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='93_8XMSOOu0_kIfElCZTcNDPXyZ0rUh6CXkKtDd-CGAYsSFXcWMggsZyqtlqrYmDQOVMziu5T8CIQ4zL0VrnpKVl85vZ4pCE-cXyL3rHL9Q=@proton.me' \
    --to=bug-gnu-emacs@gnu.org \
    --cc=73505@debbugs.gnu.org \
    --cc=zyd-p@proton.me \
    /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).