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

From: Michael Heerdegen <[email-masked]>
Date: Mon, 28 Oct 2024 14:58:37 +0100

Stefan Monnier <[email-masked]> writes:

> The only natural semantics for something like when-let is the
> "sequential" bindings of `let*`.  The `let` and `letrec` semantics are
> "unnatural" here, so we should have only the `let*` semantics.

I do not see an if-let where condition testing return values are
referenced in THEN, but conditions are independent and exchangeable, as
necessarily unnatural.  Even when the implementation:

> [...] to something like:
>     (when-let* ((t1 (fooa))
>                 (t2 (foob))
>                 ...)
>       (let ((a t1)
>             (b t2)
>             ...)
>         (bar)))

would not be as straightforward as for `if-let*'.

> So coders who "simplify" `when-let*` to `when-let` when the * version is
> not needed, would in reality just pessimize their code.

The other side is readability, like for `let' vs. `let*'.  In my
experience condition not too seldom are independent from each other.  I
would be able to make that explicit for the human reader.

But if all of you guys don't like the idea then ...ok, so it be.

> I'll let you guess where I stand w.r.t to naming of `when-let` vs
> `when-let*`, based on the fact that I originally implemented `dlet` with
> the semantics of `let*`.  🙂

Your timing of mentioning such things still has an epsilon of room for
improvement.

Michael.