[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#66706: [PATCH] Automatic elisp dialect insertion
From: |
Drew Adams |
Subject: |
bug#66706: [PATCH] Automatic elisp dialect insertion |
Date: |
Thu, 26 Oct 2023 02:28:25 +0000 |
> In particular, what's missing from the following paragraph[1]?
>
> > Another way to think about let is that it is like a setq that is
> temporary and local. The values set by let are automatically undone when
> the let is finished. The setting only affects expressions that are inside
> the bounds of the let expression. In computer science jargon, we would say
> the binding of a symbol is visible only in functions called in the let
> form; in Emacs Lisp, the default scoping is dynamic, not lexical. (The
> non-default lexical binding is not discussed in this manual.)
This bit would be far off-base for a description
of lexical let-binding:
when the let is finished
^^^^ ^^^^^^^^
That's excusable for the Intro Lisp manual back
when Elisp had only dynamic binding. It fits only
dynamic, not lexical, let-binding.
A description of a lexical let binding should talk
about lexical scope - a limit you can see "on the
page" (it's lexical) - a limit on "where" in code,
not "when" in code evaluation.
"Finished" is nearly as bad (for lexical binding),
as it has a (strong) connotation of process/time.
For lexical binding it's about where the let sexp
ends, not when let processing finishes.
OTOH, "local" _is_ pertinent for lexical, but it's
about being local _lexically_: local means inside
the let sexp. A lexical binding doesn't exist
outside that scope.
And this bit is not true for dynamic binding:
The setting only affects expressions that are
inside the bounds of the let expression.
It affects expressions that are evaluated within
the extent (time) of the dynamic let binding.
There's _no_ limit on the scope, dynamically -
it's indefinite: anything, anywhere, can refer to
a thing that's dynamically bound.
If looking for a clear and palatable description
then let me suggest starting with the way lexical
and dynamic binding are presented in CLTL2:
https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node43.html#SECTION00700000000000000000
And from the moment the language has both lexical
and dynamic binding (as it does now), a description
of let needs to also get into the fact that it can
bind dynamic (special) variables also - the overall
behavior is more complicated to describe because of
that.
- bug#66706: [PATCH] Automatic elisp dialect insertion, (continued)
- bug#66706: [PATCH] Automatic elisp dialect insertion, Dmitry Gutov, 2023/10/25
- bug#66706: [PATCH] Automatic elisp dialect insertion, Po Lu, 2023/10/25
- bug#66706: [PATCH] Automatic elisp dialect insertion, Dmitry Gutov, 2023/10/25
- bug#66706: [PATCH] Automatic elisp dialect insertion, Jim Porter, 2023/10/25
- bug#66706: [PATCH] Automatic elisp dialect insertion, Po Lu, 2023/10/25
- bug#66706: [PATCH] Automatic elisp dialect insertion, Stefan Monnier, 2023/10/25
- bug#66706: [PATCH] Automatic elisp dialect insertion, Jim Porter, 2023/10/25
- bug#66706: [PATCH] Automatic elisp dialect insertion, Po Lu, 2023/10/25
- bug#66706: [PATCH] Automatic elisp dialect insertion, Jim Porter, 2023/10/25
- bug#66706: [PATCH] Automatic elisp dialect insertion, Drew Adams, 2023/10/25
- bug#66706: [PATCH] Automatic elisp dialect insertion,
Drew Adams <=
- bug#66706: [PATCH] Automatic elisp dialect insertion, Eli Zaretskii, 2023/10/26
- bug#66706: [PATCH] Automatic elisp dialect insertion, Eli Zaretskii, 2023/10/25
- bug#66706: [PATCH] Automatic elisp dialect insertion, Stefan Monnier, 2023/10/25
- bug#66706: [PATCH] Automatic elisp dialect insertion, Eli Zaretskii, 2023/10/25
- bug#66706: [PATCH] Automatic elisp dialect insertion, Dmitry Gutov, 2023/10/25
- bug#66706: [PATCH] Automatic elisp dialect insertion, Stefan Monnier, 2023/10/25
- bug#66706: [PATCH] Automatic elisp dialect insertion, Po Lu, 2023/10/25
- bug#66706: [PATCH] Automatic elisp dialect insertion, Mattias EngdegÄrd, 2023/10/25
- bug#66706: [PATCH] Automatic elisp dialect insertion, Eli Zaretskii, 2023/10/25
- bug#66706: [PATCH] Automatic elisp dialect insertion, Mattias EngdegÄrd, 2023/10/25