From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 73853@debbugs.gnu.org
Cc: monnier@iro.umontreal.ca
Subject: bug#73853: 31.0.50; and-let* is useless
Date: Thu, 17 Oct 2024 12:27:39 -0400 [thread overview]
Message-ID: <jwv4j5aeltw.fsf@iro.umontreal.ca> (raw)
Package: Emacs
Version: 31.0.50
According to its docstring, `and-let*` does:
Bind variables according to VARLIST and conditionally evaluate BODY.
Like `when-let*', except if BODY is empty and all the bindings
are non-nil, then the result is the value of the last binding.
IOW the only time it's different from `when-let*` is when BODY is empty,
i.e. its only "feature" compares to `when-let*` is that
(and-let* (..BINDINGS..
(last (binding))))
is equivalent to
(and-let* (..BINDINGS..)
(binding))
Why would anyone write the first instead of the second, other than out
of masochism? Can we kill/deprecate this?
[ I think we have too many (if|when|and)-let(*) for our own good: we
should pick some winners and deprecate the other ones. ]
I could see a use for something called `and-let(*)` but without a BODY,
for the purpose of remove a level of parens and indentation:
(and-let*
(x1 (foo1))
(x2 (foo2)))
i.s.o
(and-let*
((x1 (foo1))
(x2 (foo2))))
- Stefan
next reply other threads:[~2024-10-17 16:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 16:27 Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-10-17 16:40 ` bug#73853: 31.0.50; and-let* is useless Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-18 2:11 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-18 23:42 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-19 3:50 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-19 3:38 ` Sean Whitton
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=jwv4j5aeltw.fsf@iro.umontreal.ca \
--to=bug-gnu-emacs@gnu.org \
--cc=73853@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/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).