emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-25 c04ac8a: Document that variable binding order is


From: Philipp Stephani
Subject: [Emacs-diffs] emacs-25 c04ac8a: Document that variable binding order is unspecified
Date: Fri, 23 Dec 2016 16:29:25 +0000 (UTC)

branch: emacs-25
commit c04ac8a3191820d37e7858b7ca4e31cf04808cc3
Author: Philipp Stephani <address@hidden>
Commit: Philipp Stephani <address@hidden>

    Document that variable binding order is unspecified
    
    * doc/lispref/variables.texi (Local Variables):
    * cl.texi (Modify Macros): Document that binding order in 'let' and
    'cl-letf' is unspecified.
---
 doc/lispref/variables.texi |   12 ++++++++++++
 doc/misc/cl.texi           |    5 +++++
 2 files changed, 17 insertions(+)

diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
index a2d6481..ba31f85 100644
--- a/doc/lispref/variables.texi
+++ b/doc/lispref/variables.texi
@@ -221,6 +221,18 @@ Here is an example of this: @code{z} is bound to the old 
value of
      @result{} (1 2)
 @end group
 @end example
+
+On the other hand, the order of @emph{bindings} is unspecified: in the
+following example, either 1 or 2 might be printed.
+
address@hidden
+(let ((x 1)
+      (x 2))
+  (print x))
address@hidden example
+
+Therefore, avoid binding a variable more than once in a single
address@hidden form.
 @end defspec
 
 @defspec let* (address@hidden) address@hidden
diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi
index c62fa72..75a8360 100644
--- a/doc/misc/cl.texi
+++ b/doc/misc/cl.texi
@@ -1179,6 +1179,11 @@ behavior.  (@code{point} and @code{point-marker} are 
equivalent
 as @code{setf} places; each will accept either an integer or a
 marker as the stored value.)
 
+Like in the case of @code{let}, the @var{value} forms are evaluated in
+the order they appear, but the order of bindings is unspecified.
+Therefore, avoid binding the same @var{place} more than once in a
+single @code{cl-letf} form.
+
 Since generalized variables look like lists, @code{let}'s shorthand
 of using @samp{foo} for @samp{(foo nil)} as a @var{binding} would
 be ambiguous in @code{cl-letf} and is not allowed.



reply via email to

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