Subject: Re: bug#73853: 31.0.50; and-let* is useless

From: Augusto Stoffel <[email-masked]>
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).