Subject: RE: [External] : bug#66706: [PATCH] Automatic elisp dialect insertion

From: Drew Adams <[email-masked]>
Date: Thu, 26 Oct 2023 15:36:23 +0000

> Dynamic binding allows you to tweak some behavior when you have to
> conform to an existing API, even when it has not been properly designed
> to to support your use case. We just don't know how much 3rd party code
> uses it in this perfectly valid way and refactoring those mature API to
> support even some of the use cases like that may not be realistically
> doable or worth it in the first place.

I believe this discussion is not about dynamic
binding as such; it's about having the default
be lexical binding.

That is, it's about having, by default, the
behavior you get with lexical-binding=nil.

That doesn't prevent any use of dynamic binding.
What it does is make Elisp behave like Common
Lisp wrt lexical/dynamic: It makes lexical
binding the _default_; nothing more.  To get
dynamic binding for something you need to tell
Lisp that it's "special".

And yes, everything you said about dynamic
binding is correct: it is extremely useful, in
particular for an application such as Emacs.

But wrt that there should be no special need
to refactor anything.  The problem (need for
rewriting/refactoring) is code for code that
expects or depends on dynamic binding by
default.

Long ago RMS summarized the special advantages
dynamic binding offers for an app such as Emacs:

https://www.gnu.org/software/emacs/emacs-paper.html#SEC17

https://www.gnu.org/software/emacs/emacs-paper.html#SEC18