bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Michael Heerdegen
Subject: bug#73853: 31.0.50; and-let* is useless
Date: Sat, 19 Oct 2024 05:50:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> But there isn't the same "historical" support that justifies having
> both, and the syntax&semantics of `and-let*` is just weird:
>
> - Why allow a BODY if the motivation is to mirror the normal `and`?
>   If you want a BODY, use `when-let*`.
> - What's the use of the final variable binding since (assuming you
>   don't use BODY) that variable is never used:
>
>      (and-let* ((a (fooa))
>                 (b (foob a))
>                 (i-m-useless (fooc a b))))

One could say BODY _is_ the final condition and therefore it has a
special syntax because it necessarily doesn't need a binding.  That way
I've my peace with that syntax.

Anyway, removing `and-let*' would be equally unsatisfying, and
obviously, at least one the two points will remain unless we change
the syntax radically - or remove `and-let*' :-(

> - There's a special syntax where the final binding can drop the variable
>   name (because of the previous point), which makes for an odd syntax
>
>      (and-let* ((a (fooa))
>                 (b (foob a))
>                 ((weird-call a b))))

That I feel too.  As an alternative we made the pseudo variable _ work
without compiler warnings.  But one gets used to the variable-less
syntax.  It's too handy...

> So the use with BODY is redundant with `when-let*` and the use without
> BODY is quirky (and still redundant with `when-let*`, of course).

I see your points, but don't consider them as such a big problem.
Anyway, without having something that is obviously better the discussion
remains quite philosophical.  And replacing calls of `and-let*' with
equivalent calls of `when-let*' doesn't make code easier to read, IMO.

> 100% agreement.  Can we `make-obsolete` the non-star versions?

I hope we can.


Michael.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]