GNU bug report logs -
#73853
Should and-let* become a synonym for when-let*?
Previous Next
Full log
View this message in rfc822 format
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
> Then write it with `when-let` and get used to the idea that it returns
> a value, because... well, it does and code out there relies on it (a
> small random sampling suggests that around 15% of the existing uses in
> Emacs do).
But Stefan, if we replace calls of `and-let' with `when-let', I would
not only have to get used to the idea "that it returns a value", but I
also would have to remember what happens when `when-let' is used as a
condition (e.g. in an `if') with an empty body. I would always ask:
which of the semantics did we choose again...? This is not better than
what you currently dislike. I would then have to remember and consult
the doc instead of you. It seems a bit that you assume that I can
remember things with much less effort than you.
I mean, there is only one "subtle difference" between `and-let' and
`when-let' - the handling of an empty body - right? Isn't it absolutely
"clear" what an empty body means in both cases?
> > There is a third option btw: remove `when-let' instead of `and-let'.
> `grep` suggests that will not be popular.
> At least in Emacs + (Non)GNU ELPA, we're talking 233 vs 3093.
That may be and is expected. But with `and-let*' semantics we could
keep 233+3093 but with `when-let*' semantics we would probably only keep
3093 or replace some of the 233 with something which is harder to read.
The real question is: which of the semantics is more popular when you
have no choice. A completely different question that you bring up when
you want to remove one.
Michael.
This bug report was last modified 140 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.