unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#73853: 31.0.50; and-let* is useless
@ 2024-10-17 16:27 Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-10-17 16:40 ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
                   ` (2 more replies)
  0 siblings, 3 replies; 38+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-17 16:27 UTC (permalink / raw)
  To: 73853; +Cc: monnier

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






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

end of thread, other threads:[~2024-10-30 23:10 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-17 16:27 bug#73853: 31.0.50; and-let* is useless Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-17 16:40 ` 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-21  7:07     ` Augusto Stoffel
2024-10-21  8:57       ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-21 12:09         ` Sean Whitton
2024-10-19  3:38   ` Sean Whitton
2024-10-20 12:24     ` Stefan Kangas
2024-10-22 14:47       ` bug#73853: 31.0.50; Should and-let* become a synonym for when-let*? Sean Whitton
2024-10-22 15:24         ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-23 14:05           ` Stefan Kangas
2024-10-24  8:51             ` Sean Whitton
2024-10-25 12:09               ` Sean Whitton
2024-10-30  9:42                 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-26 19:25           ` Jim Porter
2024-10-27  7:08             ` Stefan Kangas
2024-10-27  9:16               ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-27 10:12                 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-27 11:24                   ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-27 11:32                     ` Sean Whitton
2024-10-27 11:44                     ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-27 12:28                       ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-27 13:10                         ` Sean Whitton
2024-10-27 13:22                         ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-28  9:39                           ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-27 14:41                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-28 13:58                   ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-28 14:32                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-27 20:00                 ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-28  2:15           ` Howard Melman
2024-10-28  3:19             ` Sean Whitton
2024-10-29 15:21 ` Jonas Bernoulli
2024-10-29 16:36   ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-30  0:49   ` Sean Whitton
2024-10-30 12:55   ` Corwin Brust
2024-10-30 23:10   ` Stefan Kangas

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