GNU bug report logs -
#66940
Dynamic scoping is all weird now?
Previous Next
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
Message #29 received at 66940 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Here's the simplest MRE I have so far -
(progn
(setq lexical-binding nil)
(let ((ii 1))
(defmacro mac ()
`(message "%S" ,ii)
)
(mac)))
Eval it three times, using C-x C-e.
Error on the third time.
(Following the prior response, I figured I will discuss on devel first to
confirm before officially reporting it, but was kinda directed back here.)
On Sun, Nov 5, 2023 at 2:07 PM Dave Goel <deego3 <at> gmail.com> wrote:
> 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.