GNU bug report logs - #66706
[PATCH] Automatic elisp dialect insertion

Previous Next

Package: emacs;

Reported by: Mattias Engdegård <mattias.engdegard <at> gmail.com>

Date: Mon, 23 Oct 2023 17:48:01 UTC

Severity: wishlist

Tags: patch

Full log


View this message in rfc822 format

From: Drew Adams <drew.adams <at> oracle.com>
To: Jim Porter <jporterbugs <at> gmail.com>, Po Lu <luangruo <at> yahoo.com>, Dmitry Gutov <dmitry <at> gutov.dev>
Cc: Eli Zaretskii <eliz <at> gnu.org>, "66706 <at> debbugs.gnu.org" <66706 <at> debbugs.gnu.org>, "mattias.engdegard <at> gmail.com" <mattias.engdegard <at> gmail.com>, "stefankangas <at> gmail.com" <stefankangas <at> gmail.com>, Stefan Monnier <monnier <at> iro.umontreal.ca>
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.

This bug report was last modified 1 year and 238 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.