[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#73853: 31.0.50; Should and-let* become a synonym for when-let*?
From: |
Michael Heerdegen |
Subject: |
bug#73853: 31.0.50; Should and-let* become a synonym for when-let*? |
Date: |
Sun, 27 Oct 2024 10:16:00 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Stefan Kangas <stefankangas@gmail.com> writes:
> Jim Porter <jporterbugs@gmail.com> writes:
>
> > On the other hand, the way bindings work in 'if-let*' and 'when-let*'
> > are closer to 'let*' than 'let'. I think that's a false friend though,
> > since they're only similar, not actually the same (of course the
> > semantics couldn't be exactly the same or there'd be no reason for
> > 'if-let*' and 'when-let*' to exist).
>
> FWIW, this is the argument that convinced me that the `*`-versions are
> better: bindings are more like in `let` than in `let*`. To my mind,
> that makes the `*`-naming more self-documenting and clear.
In the meantime I found out that I am not as decided as I thought:
I am actually using both versions in my own code. Valid arguments for
either name exist - and it even depends on the case:
In this case I prefer the name without star:
#+begin_src emacs-lisp
(if-let ((a (does-an-a-exist?-then-return-it)))
(use a)
(do-something-else))
#+end_src
Here I prefer the name with star:
#+begin_src emacs-lisp
(and-let* ((a (an-a-exists))
(b (b-depending-on-a-also-exists)))
(test-using a b))
#+end_src
Thinking the first example further we could introduce parallel versions
and name them `if-let', `when-let' and `and-let'. They would be really
analogue to `let' with respect to binding list semantics - compared to
the non-parallel counterparts `if-let*' that are what we have now.
ATM this idea looks appealing to me as a final goal.
Michael.
- bug#73853: 31.0.50; and-let* is useless, (continued)
- bug#73853: 31.0.50; and-let* is useless, Sean Whitton, 2024/10/18
- bug#73853: 31.0.50; and-let* is useless, Stefan Kangas, 2024/10/20
- bug#73853: 31.0.50; Should and-let* become a synonym for when-let*?, Sean Whitton, 2024/10/22
- bug#73853: 31.0.50; Should and-let* become a synonym for when-let*?, Michael Heerdegen, 2024/10/22
- bug#73853: 31.0.50; Should and-let* become a synonym for when-let*?, Stefan Kangas, 2024/10/23
- bug#73853: 31.0.50; Should and-let* become a synonym for when-let*?, Sean Whitton, 2024/10/24
- bug#73853: 31.0.50; Should and-let* become a synonym for when-let*?, Sean Whitton, 2024/10/25
- bug#73853: 31.0.50; Should and-let* become a synonym for when-let*?, Jim Porter, 2024/10/26
- bug#73853: 31.0.50; Should and-let* become a synonym for when-let*?, Stefan Kangas, 2024/10/27
- bug#73853: 31.0.50; Should and-let* become a synonym for when-let*?,
Michael Heerdegen <=
- bug#73853: 31.0.50; Should and-let* become a synonym for when-let*?, Michael Albinus, 2024/10/27
- bug#73853: 31.0.50; Should and-let* become a synonym for when-let*?, Michael Heerdegen, 2024/10/27
- bug#73853: 31.0.50; Should and-let* become a synonym for when-let*?, Sean Whitton, 2024/10/27
- bug#73853: 31.0.50; Should and-let* become a synonym for when-let*?, Michael Albinus, 2024/10/27
- bug#73853: 31.0.50; Should and-let* become a synonym for when-let*?, Michael Heerdegen, 2024/10/27
- bug#73853: 31.0.50; Should and-let* become a synonym for when-let*?, Sean Whitton, 2024/10/27
- bug#73853: 31.0.50; Should and-let* become a synonym for when-let*?, Michael Albinus, 2024/10/27
- bug#73853: 31.0.50; Should and-let* become a synonym for when-let*?, Michael Heerdegen, 2024/10/28
- bug#73853: 31.0.50; Should and-let* become a synonym for when-let*?, Stefan Monnier, 2024/10/27
- bug#73853: 31.0.50; Should and-let* become a synonym for when-let*?, Michael Heerdegen, 2024/10/28