all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: Sean Devlin <spd@toadstyle.org>
Cc: 43601@debbugs.gnu.org
Subject: bug#43601: 27.1; Macroexpansion bug in `push'
Date: Fri, 25 Sep 2020 11:35:35 +0200	[thread overview]
Message-ID: <CAArVCkRpBMTKoxofqNEGpHy2D1z+v2OXFcZ2TQw4L-MxupvSzA@mail.gmail.com> (raw)
In-Reply-To: <33F8870E-E0A5-43EC-98A2-7EF3DA2CCD53@toadstyle.org>

Am Fr., 25. Sept. 2020 um 00:56 Uhr schrieb Sean Devlin <spd@toadstyle.org>:
>
> 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.


These are different uninterned symbols:

(let ((print-gensym t) (print-circle t))
  (print (macroexpand '(push (list 'x) (cdr my-list))))
  nil)

⇒ (let* ((#2=#:v (list 'x)) (#1=#:v my-list)) (setcdr #1# (cons #2# (cdr #1#))))

In general, if you see a "weird" expansion like this, bind
print-gensym to non-nil to see the uninterned symbols.





  parent reply	other threads:[~2020-09-25  9:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-24 22:54 bug#43601: 27.1; Macroexpansion bug in `push' Sean Devlin
     [not found] ` <handler.43601.B.160098811131831.ack@debbugs.gnu.org>
2020-09-24 23:17   ` bug#43601: Acknowledgement (27.1; Macroexpansion bug in `push') Sean Devlin
2020-09-25  5:56 ` bug#43601: 27.1; Macroexpansion bug in `push' Phil Sainty
2020-09-25  9:35 ` Philipp Stephani [this message]
2020-09-25  9:40   ` Lars Ingebrigtsen
2020-09-26 15:05     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAArVCkRpBMTKoxofqNEGpHy2D1z+v2OXFcZ2TQw4L-MxupvSzA@mail.gmail.com \
    --to=p.stephani2@gmail.com \
    --cc=43601@debbugs.gnu.org \
    --cc=spd@toadstyle.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.