unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#33550: [PATCH] mention let* in if-let
@ 2018-11-29 19:18 Alex Branham
  2018-11-29 19:43 ` Eli Zaretskii
  2019-06-23 20:56 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 7+ messages in thread
From: Alex Branham @ 2018-11-29 19:18 UTC (permalink / raw)
  To: 33550

[-- Attachment #1: Type: text/plain, Size: 1285 bytes --]

Hi -

I think this patch makes it much clearer that if-let functions like
let*, not let.

Thanks,
Alex

From 0504ba0c88bc63b527e54fc92e1923e60ff5759a Mon Sep 17 00:00:00 2001
From: Alex Branham <alex.branham@gmail.com>
Date: Thu, 29 Nov 2018 12:57:43 -0600
Subject: [PATCH] ; * lisp/emacs-lisp/subr-x.el (if-let): Improve docstring by
 mentioning let*

---
 lisp/emacs-lisp/subr-x.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 7fab9083e8..8278f50d1d 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -158,9 +158,9 @@ are non-nil, then the result is non-nil."

 (defmacro if-let (spec then &rest else)
   "Bind variables according to SPEC and eval THEN or ELSE.
-Each binding is evaluated in turn, and evaluation stops if a
-binding value is nil.  If all are non-nil, the value of THEN is
-returned, or the last form in ELSE is returned.
+Each binding is evaluated in turn, as in `let*', and evaluation
+stops if a binding value is nil.  If all are non-nil, the value
+of THEN is returned, or the last form in ELSE is returned.

 Each element of SPEC is a list (SYMBOL VALUEFORM) which binds
 SYMBOL to the value of VALUEFORM.  An element can additionally be
--
2.19.1



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-emacs-lisp-subr-x.el-if-let-Improve-docstring-b.patch --]
[-- Type: text/x-patch, Size: 1183 bytes --]

From 0504ba0c88bc63b527e54fc92e1923e60ff5759a Mon Sep 17 00:00:00 2001
From: Alex Branham <alex.branham@gmail.com>
Date: Thu, 29 Nov 2018 12:57:43 -0600
Subject: [PATCH] ; * lisp/emacs-lisp/subr-x.el (if-let): Improve docstring by
 mentioning let*

---
 lisp/emacs-lisp/subr-x.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 7fab9083e8..8278f50d1d 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -158,9 +158,9 @@ are non-nil, then the result is non-nil."
 
 (defmacro if-let (spec then &rest else)
   "Bind variables according to SPEC and eval THEN or ELSE.
-Each binding is evaluated in turn, and evaluation stops if a
-binding value is nil.  If all are non-nil, the value of THEN is
-returned, or the last form in ELSE is returned.
+Each binding is evaluated in turn, as in `let*', and evaluation
+stops if a binding value is nil.  If all are non-nil, the value
+of THEN is returned, or the last form in ELSE is returned.
 
 Each element of SPEC is a list (SYMBOL VALUEFORM) which binds
 SYMBOL to the value of VALUEFORM.  An element can additionally be
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#33550: [PATCH] mention let* in if-let
  2018-11-29 19:18 bug#33550: [PATCH] mention let* in if-let Alex Branham
@ 2018-11-29 19:43 ` Eli Zaretskii
  2018-11-29 19:46   ` Alex Branham
  2019-04-18  0:25   ` Noam Postavsky
  2019-06-23 20:56 ` Lars Ingebrigtsen
  1 sibling, 2 replies; 7+ messages in thread
From: Eli Zaretskii @ 2018-11-29 19:43 UTC (permalink / raw)
  To: Alex Branham; +Cc: 33550

> From: Alex Branham <alex.branham@gmail.com>
> Date: Thu, 29 Nov 2018 13:18:54 -0600
> 
> I think this patch makes it much clearer that if-let functions like
> let*, not let.

Doesn't "in turn" already say that?





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#33550: [PATCH] mention let* in if-let
  2018-11-29 19:43 ` Eli Zaretskii
@ 2018-11-29 19:46   ` Alex Branham
  2019-04-18  0:25   ` Noam Postavsky
  1 sibling, 0 replies; 7+ messages in thread
From: Alex Branham @ 2018-11-29 19:46 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 33550


On Thu 29 Nov 2018 at 13:43, Eli Zaretskii <eliz@gnu.org> wrote:

>> I think this patch makes it much clearer that if-let functions like
>> let*, not let.
>
> Doesn't "in turn" already say that?

Yes, it does, you're completely right. This just emphasizes that if-let
acts like let* for those of us who perhaps skim documentation instead of
reading closely sometimes. I found it somewhat surprising that if-let
versus if-let* is not like let versus let*.

Alex





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#33550: [PATCH] mention let* in if-let
  2018-11-29 19:43 ` Eli Zaretskii
  2018-11-29 19:46   ` Alex Branham
@ 2019-04-18  0:25   ` Noam Postavsky
  2019-04-18  3:44     ` Michael Heerdegen
  1 sibling, 1 reply; 7+ messages in thread
From: Noam Postavsky @ 2019-04-18  0:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Alex Branham, 33550

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Alex Branham <alex.branham@gmail.com>
>> Date: Thu, 29 Nov 2018 13:18:54 -0600
>> 
>> I think this patch makes it much clearer that if-let functions like
>> let*, not let.
>
> Doesn't "in turn" already say that?

I think it's a bit ambiguous, it could refer to the fact that each
VALUEFORM is evaluted sequentially.  It's not entirely obvious that
previous SYMBOL bindings are available to follow VALUEFORMs, as in let*
rather than let (which would be the more obvious choice for if-let as
opposed to if-let*).






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#33550: [PATCH] mention let* in if-let
  2019-04-18  0:25   ` Noam Postavsky
@ 2019-04-18  3:44     ` Michael Heerdegen
  2019-04-18  3:47       ` Michael Heerdegen
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Heerdegen @ 2019-04-18  3:44 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 33550, Alex Branham

Noam Postavsky <npostavs@gmail.com> writes:

> I think it's a bit ambiguous, it could refer to the fact that each
> VALUEFORM is evaluted sequentially.  It's not entirely obvious that
> previous SYMBOL bindings are available to follow VALUEFORMs, as in let*
> rather than let

Yes, true.

> (which would be the more obvious choice for if-let as opposed to
> if-let*).

if-let mainly exists for backward compatibility (to support the "SPEC of
the form (SYMBOL SOMETHING)" case).  I don't recall why we didn't
obsolete it when we added if-let*, but AFAIR the special case had been
quite widely used.  Anyway, I think we should not change it.

Michael.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#33550: [PATCH] mention let* in if-let
  2019-04-18  3:44     ` Michael Heerdegen
@ 2019-04-18  3:47       ` Michael Heerdegen
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Heerdegen @ 2019-04-18  3:47 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 33550, Alex Branham

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Anyway, I think we should not change it.

Sorry for having been unclear: I meant we shouldn't change the binding
behavior, I don't want to oppose clarifying the docstring.

Michael.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#33550: [PATCH] mention let* in if-let
  2018-11-29 19:18 bug#33550: [PATCH] mention let* in if-let Alex Branham
  2018-11-29 19:43 ` Eli Zaretskii
@ 2019-06-23 20:56 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-23 20:56 UTC (permalink / raw)
  To: Alex Branham; +Cc: 33550

Alex Branham <alex.branham@gmail.com> writes:

>  (defmacro if-let (spec then &rest else)
>    "Bind variables according to SPEC and eval THEN or ELSE.
> -Each binding is evaluated in turn, and evaluation stops if a
> -binding value is nil.  If all are non-nil, the value of THEN is
> -returned, or the last form in ELSE is returned.
> +Each binding is evaluated in turn, as in `let*', and evaluation
> +stops if a binding value is nil.  If all are non-nil, the value
> +of THEN is returned, or the last form in ELSE is returned.

Yes, I think that's clearer, because it's a bit surprising that if-let
is more like let* than let.  I've now applied your change to the Emacs
trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-06-23 20:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29 19:18 bug#33550: [PATCH] mention let* in if-let Alex Branham
2018-11-29 19:43 ` Eli Zaretskii
2018-11-29 19:46   ` Alex Branham
2019-04-18  0:25   ` Noam Postavsky
2019-04-18  3:44     ` Michael Heerdegen
2019-04-18  3:47       ` Michael Heerdegen
2019-06-23 20:56 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).