GNU bug report logs - #73853
Should and-let* become a synonym for when-let*?

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Thu, 17 Oct 2024 16:31:02 UTC

Severity: wishlist

Found in version 31.0.50

Full log


Message #171 received at 73853 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 73853 <at> debbugs.gnu.org, Sean Whitton <spwhitton <at> spwhitton.name>
Subject: Re: bug#73853: Should and-let* become a synonym for when-let*?
Date: Sat, 18 Jan 2025 01:26:44 +0100
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> > Right.  The Lisp convention of using `when' for pure control flow and
> > `and' for returning values is a good aid to readability.
>
> AFAIK this convention is followed only by some coders, so it doesn't
> help readability because you can't rely on it.

This is a weak argument of its own.  You can't rely on any convention
being honored in the code.  That doesn't mean that it's a bad convention.

> > If we don't have and-let*, then we can't use this convention in the case
> > that we also want to bind variables.
>
> Then again, we don't have such a "value returning vs not" duplication
> and associated convention for `let`, `progn`, `lambda`,
> `unwind-protect`, `catch`, `condition-case, ...
>
> The fact we have all three of if/when/and is not a good justification
> for `and-let*`.

if/when/let are a bit different than the constructs in your list because
the values in conditionals have different semantics when interpreted as
a conditional than as an value or object.  This is part of the reason.

I can't imagine that changing (if (and-let ...) ...) to
(if (when-let ...) ...) is something that makes the language more
attractive, even when we get rid of the similar twin thing, or how you
called it.

So my opinion is still that we have to decide between two similarly
not-so-nice choices, and which one is preferred is more a matter of
taste, so the hassle of changing it is not worth it.


Michael.




This bug report was last modified 140 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.