From: Michael Heerdegen via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 73853@debbugs.gnu.org
Subject: bug#73853: 31.0.50; and-let* is useless
Date: Sat, 19 Oct 2024 05:50:49 +0200 [thread overview]
Message-ID: <87sess3g4m.fsf@web.de> (raw)
In-Reply-To: <jwvbjzhasvw.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Fri, 18 Oct 2024 19:42:44 -0400")
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> But there isn't the same "historical" support that justifies having
> both, and the syntax&semantics of `and-let*` is just weird:
>
> - Why allow a BODY if the motivation is to mirror the normal `and`?
> If you want a BODY, use `when-let*`.
> - What's the use of the final variable binding since (assuming you
> don't use BODY) that variable is never used:
>
> (and-let* ((a (fooa))
> (b (foob a))
> (i-m-useless (fooc a b))))
One could say BODY _is_ the final condition and therefore it has a
special syntax because it necessarily doesn't need a binding. That way
I've my peace with that syntax.
Anyway, removing `and-let*' would be equally unsatisfying, and
obviously, at least one the two points will remain unless we change
the syntax radically - or remove `and-let*' :-(
> - There's a special syntax where the final binding can drop the variable
> name (because of the previous point), which makes for an odd syntax
>
> (and-let* ((a (fooa))
> (b (foob a))
> ((weird-call a b))))
That I feel too. As an alternative we made the pseudo variable _ work
without compiler warnings. But one gets used to the variable-less
syntax. It's too handy...
> So the use with BODY is redundant with `when-let*` and the use without
> BODY is quirky (and still redundant with `when-let*`, of course).
I see your points, but don't consider them as such a big problem.
Anyway, without having something that is obviously better the discussion
remains quite philosophical. And replacing calls of `and-let*' with
equivalent calls of `when-let*' doesn't make code easier to read, IMO.
> 100% agreement. Can we `make-obsolete` the non-star versions?
I hope we can.
Michael.
next prev parent reply other threads:[~2024-10-19 3:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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=87sess3g4m.fsf@web.de \
--to=bug-gnu-emacs@gnu.org \
--cc=73853@debbugs.gnu.org \
--cc=michael_heerdegen@web.de \
--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).