GNU bug report logs - #66940
Dynamic scoping is all weird now?

Previous Next

Package: emacs;

Reported by: Dave Goel <deego3 <at> gmail.com>

Date: Sun, 5 Nov 2023 04:08:02 UTC

Severity: normal

Tags: notabug

Done: Michael Heerdegen <michael_heerdegen <at> web.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dave Goel <deego3 <at> gmail.com>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: 66940 <at> debbugs.gnu.org
Subject: bug#66940: Dynamic scoping is all weird now?
Date: Sun, 5 Nov 2023 14:07:02 -0500
[Message part 1 (text/plain, inline)]
Gerd,

Ok.

I hope this bugreport is clearer -

Here's some code.

The variable ii is clearly set every time mac was defined OR called.

backquote should expand, and mac should have read its content as (list
'message "%S" ii).




(progn
  (setq lexical-binding nil)

  (dotimes (ii 10)
    (defmacro mac ()
      `(message "%S" ,ii)
      )
    (let
        ((old_ii ii))
      (setq ii 33)
      (mac)
      (setq ii old_ii)
      )))


You eval this code once. It works.
You eval this again. It works.
The third time, though, it lands you in the debugger. The very same code.
Why the third time? And, why the debugger?  ii is well set every time it is
used.

That was bug (b). That's clearly an emacs bug?


Here's (c) -

The third time, change every "ii" to "var" ,and change every "old_ii" to
"old_var".
And, evaluate it.
We still get the very same error, but the error involves ii, not var. The
code we are defining and eval'ing has no "ii" whatsoever. It should have
forgotten the old mac that involved ii. We defined a new mac involving
"var."


>
>
[Message part 2 (text/html, inline)]

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

Previous Next


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