emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 489a106: Document `letrec'


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 489a106: Document `letrec'
Date: Wed, 9 Oct 2019 00:06:34 -0400 (EDT)

branch: master
commit 489a106b1c16f422989e20471c3c2f26b2149309
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Document `letrec'
    
    * doc/lispref/variables.texi (Local Variables): Document letrec
    (bug#21048).
    
    * lisp/subr.el (letrec): Expand the doc string slightly.
---
 doc/lispref/variables.texi | 9 +++++++++
 lisp/subr.el               | 4 +++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
index b49874f..8d6cc29 100644
--- a/doc/lispref/variables.texi
+++ b/doc/lispref/variables.texi
@@ -267,6 +267,15 @@ Compare the following example with the example above for 
@code{let}.
 @end example
 @end defspec
 
+@defspec letrec (bindings@dots{}) forms@dots{}
+This special form is like @code{let}, but all the variables are bound
+before any of the local values are computed.  The values are then
+assigned to the locally bound variables.  This is only useful when
+lexical binding is in effect, and you want to create closures that
+refer to bindings that would otherwise not yet be in effect when using
+@code{let}.
+@end defspec
+
   Here is a complete list of the other facilities that create local
 bindings:
 
diff --git a/lisp/subr.el b/lisp/subr.el
index b0a9a83..e361b83 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1739,7 +1739,9 @@ the hook's buffer-local value rather than its default 
value."
 The value of the last form in BODY is returned.
 Each element of BINDERS is a list (SYMBOL VALUEFORM) which binds
 SYMBOL to the value of VALUEFORM.
-All symbols are bound before the VALUEFORMs are evalled."
+
+The main difference between this macro and `let'/`let*' is that
+all symbols are bound before any of the VALUEFORMs are evalled."
   ;; Only useful in lexical-binding mode.
   ;; As a special-form, we could implement it more efficiently (and cleanly,
   ;; making the vars actually unbound during evaluation of the binders).



reply via email to

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