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 #29 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Augusto Stoffel <arstoffel <at> gmail.com>
To: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs <at> gnu.org>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, 73853 <at> debbugs.gnu.org
Subject: Re: bug#73853: 31.0.50; and-let* is useless
Date: Mon, 21 Oct 2024 09:07:42 +0200
On Fri, 18 Oct 2024 at 19:42, Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote:

>>> [ I think we have too many (if|when|and)-let(*) for our own good: we
>>>   should pick some winners and deprecate the other ones.   ]
>> AFAIR the non-star versions exist for backward compatibility only - so I
>> would rather get rid of these.  Parallel existence of these non-star
>> vs. star versions should be a temporary state, it complicates the matter
>> for an epsilon gain.
>
> 100% agreement.  Can we `make-obsolete` the non-star versions?

Wait... The point of make-obsolete is to generate warning so people
migrate their code, right?  So why not warn on the weird
(single-variable binding) use of the non-star version, to eventually
remove that syntax as well as the star variants?

I always type `if-let' because it looks cleaner and saves one indentation
column (which are purely cosmetic reasons), but also I think it would be
weird to have a something* when there's no accompanying something.

>>> I could see a use for something called `and-let(*)` but without a BODY,
>>> for the purpose of remove a level of parens and indentation:
>>>
>>>     (and-let*
>>>       (x1 (foo1))
>>>       (x2 (foo2)))
>>>
>>> i.s.o
>>>
>>>     (and-let*
>>>         ((x1 (foo1))
>>>          (x2 (foo2))))
>>
>> Ugh! - I could not imagine anything with more potential for confusion as
>> removing the paren around a list of bindings.
>
> FWIW, I agree, I don't like that either.

Sure, I guess nobody wants that, but this idea is getting closer to a
`thread-while' macro (variation of `thread-as') which I still maintain
would be really handy (much more so than the existing ones, which are
limited by the inconsistency of the argument ordering in Elisp).




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.