From 9c82f4805901a3670398370e5f7bf312d105b768 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mattias=20Engdeg=C3=A5rd?= Date: Fri, 20 Oct 2023 16:58:18 +0200 Subject: [PATCH] Move and edit text about lexical environment representation It's only relevant for the second argument to `eval`; the actual internal representation is an implementation matter and usually different from what was described here. * doc/lispref/variables.texi (Lexical Binding): Move the relevant part of the description of the internal representation of lexical environments from here... * doc/lispref/eval.texi (Eval): ...to here, where it belongs. --- doc/lispref/eval.texi | 7 +++++-- doc/lispref/variables.texi | 11 ----------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi index a45517287b7..ea35d4d38c7 100644 --- a/doc/lispref/eval.texi +++ b/doc/lispref/eval.texi @@ -743,10 +743,13 @@ The argument @var{lexical} specifies the scoping rule for local variables (@pxref{Variable Scoping}). If it is omitted or @code{nil}, that means to evaluate @var{form} using the default dynamic scoping rule. If it is @code{t}, that means to use the lexical scoping rule. -The value of @var{lexical} can also be a non-empty alist specifying a + +The value of @var{lexical} can also be a non-empty list specifying a particular @dfn{lexical environment} for lexical bindings; however, this feature is only useful for specialized purposes, such as in Emacs -Lisp debuggers. @xref{Lexical Binding}. +Lisp debuggers. Each member of the list is either a cons cell which +represents a lexical symbol-value pair, or a symbol representing a +dynamically bound variable. Since @code{eval} is a function, the argument expression that appears in a call to @code{eval} is evaluated twice: once as preparation before diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index dea35a04d4f..779f6233735 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -1186,17 +1186,6 @@ 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 the symbol's value cell, where the dynamic value is stored. - (Internally, the lexical environment is a list whose members are -usually cons cells that are symbol-value pairs, but some of its -members can be symbols rather than cons cells. A symbol in the list -means the lexical environment declared that symbol's variable as -locally considered to be dynamically bound. This list can be passed -as the second argument to the @code{eval} function, in order to -specify a lexical environment in which to evaluate a form. -@xref{Eval}. Most Emacs Lisp programs, however, should not interact -directly with lexical environments in this way; only specialized -programs like debuggers.) - @cindex closures, example of using Lexical bindings have indefinite extent. Even after a binding construct has finished executing, its lexical environment can be -- 2.39.2