Subject: bug#55914: 28.1; Defining as dynamic an already lexical var

From: Phil Sainty <[email-masked]>
Date: Sun, 12 Jun 2022 12:10:04 +1200

On 2022-06-12 09:33, Hendrik Tews wrote:
> From this I would conclude that the error is a bug. Or did I
> overlook something in the documentation?

It sounds like it's been upgraded from a mere description to an
error, and the point would be "definitely don't do that; and if
you see this then you should treat it as a bug to be fixed".

> (I noticed this problem because of failing tests for Proof
> General with emacs 28, see
> https://github.com/ProofGeneral/PG/issues/657. There, inside a
> let binding a Coq file is opened, which causes the Coq instance
> of Proof General to be loaded, which somewhere contained a
> defcustom for the variable that was bound with let.)

Which indicates a bug to be fixed, no?

If the variable is *supposed* to be dynamic (everywhere), then
lexical libraries which refer to it must declare (defvar FOO) to
mark it as a dynamic variable, if it's possible that the proper
definition may not yet have been loaded.

If the variable is supposed to be lexical, then it should be
renamed to something which doesn't clash with a dynamic variable.
There's need for hyphenated name-spacing for lexical vars, so the
majority of single-word names are particularly safe to use.