bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#60027: 30.0.50; Suggestions for (info "(elisp) Local Variables")


From: Michael Heerdegen
Subject: bug#60027: 30.0.50; Suggestions for (info "(elisp) Local Variables")
Date: Tue, 13 Dec 2022 04:33:59 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Hello,

two thoughts about (info "(elisp) Local Variables"):

(1) About saying that dynamical binding is the "default":

| The default scoping rule in Emacs Lisp is called “dynamic scoping”,
| which simply states that the current binding at any given point in the
| execution of a program is the most recently-created binding for that
| variable that still exists.  For details about dynamic scoping, and an
| alternative scoping rule called “lexical scoping”, *note Variable
| Scoping::.

Likewise (info "(elisp) Variable Scoping"):

| By default, the local bindings that Emacs creates are “dynamic
| bindings”.

I think saying this gets more and more confusing to newbies, now that
nearly all sources are in lexical binding, and *scratch* also is.  It's
opt-in so technically is not strictly wrong, but it is confusing
nonetheless.

I suggest to say something like that the default was dynamical binding
for a long time but Emacs is moving towards using lexical binding as
default.  People must be prepared that they will see both dialects, and
this will be the case for another 20 or 30 years at least, so it's not
wrong to tell it's an intermediate state.

But lexical binding is also not the exception any more, it is very
present.


(2) I want to suggest that in (info "(elisp) Local Variables") we add
that

(let* (BINDING1 BINDING2 ...) BODY...)

is equivalent to

(let (BINDING1)
  (let (BINDING2)
    (let ...
      BODY...)))

This would help people to understand, offering a different description,
and would also answer a question I often hear in emacs-help: If it is
legal to specify the same symbol multiple times in `let*'.  That node
describes shadowing of bindings so this is a good place to address this
question.

Michael.







reply via email to

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