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 #124 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, Jim Porter <jporterbugs <at> gmail.com>,
 Stefan Kangas <stefankangas <at> gmail.com>,
 Sean Whitton <spwhitton <at> spwhitton.name>
Subject: Re: bug#73853: 31.0.50; Should and-let* become a synonym for
 when-let*?
Date: Mon, 28 Oct 2024 14:58:37 +0100
Stefan Monnier <monnier <at> iro.umontreal.ca> 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.




This bug report was last modified 141 days ago.

Previous Next


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