GNU bug report logs - #46387
28.0.50; Compiled code making a variable dynamic stopped working

Previous Next

Package: emacs;

Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>

Date: Mon, 8 Feb 2021 17:31:02 UTC

Severity: normal

Found in version 28.0.50

Done: Mattias EngdegÄrd <mattiase <at> acm.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Mattias EngdegÄrd <mattiase <at> acm.org>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>, bug-gnu-emacs <at> gnu.org
Subject: Re: 28.0.50; Compiled code making a variable dynamic stopped working
Date: Tue, 09 Feb 2021 10:31:24 -0500
> There's a lack of clarity regarding the exact semantics of local
> `defvar`. The manual says that its effect is confined to the current
> lexical scope, but what exactly does that mean?

Adding a variable to the context creates a new scope.
A `progn` should not introduce a new scope.

> As it turns out, parts of the implementation have different opinions
> about that.

Indeed, there's a fair bit a space between my above two statements.

> As you observed, the recently added optimisation on master takes
> a strict syntactic view: even a `progn` is a lexical scope,

I think that's clearly an error.  Adding/removing `progn` shouldn't make
any difference in this respect.

> (Stefan, it looks like your latest Gnus patch may fall in the same trap. Or?)

The (with-suppressed-warnings (...) (defvar)) form is used at
several places.  It's the preferred way to declare a variable
dynamically scoped without incurring the "not prefixed" warning and
without making the `with-suppressed-warnings` silencer cover more code
than intended.


        Stefan





This bug report was last modified 4 years and 99 days ago.

Previous Next


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