* 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
2024-10-18 2:11 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 2 replies; 3+ 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] 3+ messages in thread
* bug#73853: 31.0.50; and-let* is useless
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
1 sibling, 0 replies; 3+ messages in thread
From: Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-17 16:40 UTC (permalink / raw)
To: Stefan Monnier, 73853@debbugs.gnu.org
> [ I think we have too many (if|when|and)-let(*) for our own good: we
> should pick some winners and deprecate the other ones. ]
+1.
(Are there really any winners? ;-))
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#73853: 31.0.50; and-let* is useless
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
1 sibling, 0 replies; 3+ messages in thread
From: Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-18 2:11 UTC (permalink / raw)
To: 73853; +Cc: monnier
Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:
> Can we kill/deprecate this?
`and-let*'s purpose is to express conditions, `when-let*'s is
conditional evaluation. We have `and-let*' and `when-let*' for the same
reason we have `and' and `when'. See prior discussions.
> [ I think we have too many (if|when|and)-let(*) for our own good: we
> should pick some winners and deprecate the other ones. ]
AFAIR the non-star versions exist for backward compatibility only - so I
would rather get rid of these. Parallel existence of these non-star
vs. star versions should be a temporary state, it complicates the matter
for an epsilon gain.
> 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))))
Ugh! - I could not imagine anything with more potential for confusion as
removing the paren around a list of bindings. This would add one more
year-lasting round of discussing these constructs. If you do this,
please call it `and-let*?@!' so than everybody is warned.
Michael.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-18 2:11 UTC | newest]
Thread overview: 3+ 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
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.