From 151c2837dc5c82073465f6b68e0216a0e8149cf7 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Fri, 24 Jun 2016 20:39:24 -0400 Subject: [PATCH] Clarify lexical binding with symbol args behavior * doc/lispref/variables.texi (Lexical Binding): Clarify that symbol arguments always refer to dynamic values (Bug #23781). --- doc/lispref/variables.texi | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 6c53e9b..b4d6857 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -974,7 +974,7 @@ Lexical Binding @cindex lexical environment Here is how lexical binding works. Each binding construct defines a -@dfn{lexical environment}, specifying the symbols that are bound +@dfn{lexical 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,14 @@ Lexical Binding 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 -@code{set} 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}, +@code{boundp}, and @code{set}) can 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. @node Using Lexical Binding @subsection Using Lexical Binding -- 2.8.0