Subject: Re: bug#73853: Should and-let* become a synonym for when-let*?

From: Michael Heerdegen <[email-masked]>
Date: Sat, 18 Jan 2025 01:26:44 +0100

Stefan Monnier <[email-masked]> 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.