[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-25 850ba44: Clarify lexical binding with symbol args
From: |
Noam Postavsky |
Subject: |
[Emacs-diffs] emacs-25 850ba44: Clarify lexical binding with symbol args behavior |
Date: |
Fri, 1 Jul 2016 04:05:57 +0000 (UTC) |
branch: emacs-25
commit 850ba444a7be542c8dc92efbeb4031868f3f779d
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Clarify lexical binding with symbol args behavior
* doc/lispref/variables.texi (Lexical Binding): Clarify that symbol
arguments always refer to dynamic values (Bug #23781). Remove mention
of obsolete restriction regarding lexical binding for defun and
defmacro, this no longer applies since 61b108cc 2012-05-29 "*
lisp/emacs-lisp/byte-run.el (defmacro, defun): Move from C...".
---
doc/lispref/variables.texi | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
index 6c53e9b..a2d6481 100644
--- a/doc/lispref/variables.texi
+++ b/doc/lispref/variables.texi
@@ -974,7 +974,7 @@ itself.
@cindex lexical environment
Here is how lexical binding works. Each binding construct defines a
address@hidden environment}, specifying the symbols that are bound
address@hidden environment}, specifying the variables that are bound
within the construct and their local values. When the Lisp evaluator
wants the current value of a variable, it looks first in the lexical
environment; if the variable is not specified in there, it looks in
@@ -1032,11 +1032,13 @@ lives on even after the @code{let} binding construct
has exited. Each
time we evaluate the closure, it increments @code{x}, using the
binding of @code{x} in that lexical environment.
- Note that functions like @code{symbol-value}, @code{boundp}, and
address@hidden only retrieve or modify a variable's dynamic binding
-(i.e., the contents of its symbol's value cell). Also, the code in
-the body of a @code{defun} or @code{defmacro} cannot refer to
-surrounding lexical variables.
+ Note that unlike dynamic variables which are tied to the symbol
+object itself, the relationship between lexical variables and symbols
+is only present in the interpreter (or compiler). Therefore,
+functions which take a symbol argument (like @code{symbol-value},
address@hidden, and @code{set}) can only retrieve or modify a
+variable's dynamic binding (i.e., the contents of its symbol's value
+cell).
@node Using Lexical Binding
@subsection Using Lexical Binding
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-25 850ba44: Clarify lexical binding with symbol args behavior,
Noam Postavsky <=