emacs-devel
[Top][All Lists]
Advanced

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

On the naming/behavior of {if, when}-let (was Re: Anaphoric macros: incr


From: Mark Oteiza
Subject: On the naming/behavior of {if, when}-let (was Re: Anaphoric macros: increase visibility)
Date: Sat, 14 Jan 2017 21:24:12 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Michael Heerdegen <address@hidden> writes:
> I sometimes think that
> `if-let*' would be a better name for `if-let' because bindings can refer
> (and naturally most of the time do) refer to other bindings.

There was a thread some time ago (I'd have to go dig for it) where
someone asked why the names lacked the *.  Seeing how they are
implemented on top of let*, this should be a no brainer, right?

Further, I think it's even more bizarre that if-let and when-let grew
the single tuple special case, where one can write

  (if-let (foo bar) (message "%S" foo) (message "oh no"))
          ^^^^^^^^^

What makes these binding things special? May as well add brackets and
whatever else from other lisps.

… and yet there is no _actual_ if-let to the effect of:

  (let ((a foo)
        (b bar))
    (if (and a b) 'yes 'no))

Though, for the above, I remember there being an argument against this
being useful.  IDK, I've written things like this before.

> I also
> often think that `and-let' (or `and-let*' ...)  would be a better name
> for `when-let' (because the expressions for the bindings are `and'ed,
> sot the whole thing feels more like `and' to me).

I'd also like an and-let* (presumably aliased to when-let*).



reply via email to

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