GNU bug report logs -
#43601
27.1; Macroexpansion bug in `push'
Previous Next
Reported by: Sean Devlin <spd <at> toadstyle.org>
Date: Thu, 24 Sep 2020 22:56:01 UTC
Severity: normal
Tags: fixed
Found in version 27.1
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 43601 <at> debbugs.gnu.org (full text, mbox):
On 2020-09-25 10:54, Sean Devlin wrote:
> Hi folks,
>
> I believe I've found a macroexpansion bug in the `push' macro. Open a
> new instance of Emacs and evaluate the following form in the scratch
> buffer:
>
> (macroexpand '(push (list 'x)
> (cdr my-list)))
>
> The result (with some reformatting) is this:
>
> (let* ((v (list 'x))
> (v my-list))
> (setcdr v
> (cons v
> (cdr v))))
>
> Both values are bound to `v', so the former is shadowed by the latter.
It's actually fine.
What you're seeing is the *printed representation* of the lisp objects,
and two completely independent symbols, each with the name "v".
(setq foo (macroexpand '(push (list 'x) (cdr my-list))))
=> (let* ((v (list 'x)) (v my-list)) (setcdr v (cons v (cdr v))))
(setq vfirst (caaadr foo))
=> v
(setq vsecond (car (cadadr foo)))
=> v
(eq vfirst vsecond)
=> nil
(cdaddr (caddr foo))
=> (v (cdr v))
(eq vfirst (car (cdaddr (caddr foo))))
=> t
(eq vsecond (cadadr (cdaddr (caddr foo))))
=> t
This is like:
(eq (make-symbol "v") (make-symbol "v"))
=> nil
This bug report was last modified 4 years and 317 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.