unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Wing Hei Chan <whmunkchan@outlook.com>
Cc: 56739@debbugs.gnu.org
Subject: bug#56739: 29.0.50; `cl-psetq' and `cl-psetf' fail to recognize symbol macros
Date: Mon, 05 Sep 2022 22:29:24 -0400	[thread overview]
Message-ID: <jwvy1uxqm0h.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <OSZP286MB1260387EB0097C4D07840B54DA929@OSZP286MB1260.JPNP286.PROD.OUTLOOK.COM> (Wing Hei Chan's message of "Sun, 24 Jul 2022 20:12:10 +0800")

> The following form produces (2 2) due to the failure of detecting
> dependencies involving symbol macros.
>
> (cl-symbol-macrolet ((c a))
>   (let ((a 1) (b 2))
>     (cl-psetq a b
>               b c)
>     (list a b)))

BTW, another way to get similar problems is with `defvaralias`:

    (defvaralias 'my-c 'my-a)
    (defvar my-a 1)

    (let ((b 2))
      (cl-psetq my-a b
                b my-c)
      (list my-a b))

We should probably introduce a `(macroexp|cl)--simple-var-p` test to
catch the various cases where symbols aren't simple variables.

Another thing that might be worth digging into is how important is that
`cl-psetf` optimization for lexical variables (remember: this was
written back in the days of dynamic scoping and Mattias has made some
improvements to the compiler which may render this optimization
redundant inside the macro itself.


        Stefan






      parent reply	other threads:[~2022-09-06  2:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-24 12:12 bug#56739: 29.0.50; `cl-psetq' and `cl-psetf' fail to recognize symbol macros Wing Hei Chan
2022-08-02  2:41 ` Michael Heerdegen
2022-08-02 23:59 ` Michael Heerdegen
2022-08-03  0:20   ` Michael Heerdegen
2022-09-05 19:14     ` Lars Ingebrigtsen
2022-09-06  1:29       ` Michael Heerdegen
2022-09-06  2:22     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-07 18:31       ` Stefan Kangas
2023-09-08  3:07         ` Michael Heerdegen
2023-09-09  6:12           ` Michael Heerdegen
2023-09-09  7:08             ` Gerd Möllmann
     [not found]               ` <f49326d6-85e2-4fed-83ae-815a82cefe30@outlook.com>
2023-09-09  8:03                 ` Wing Hei Chan
2023-09-09  9:24                   ` Gerd Möllmann
2023-09-09 15:42               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-09 16:33                 ` Gerd Möllmann
2022-09-06  2:29 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwvy1uxqm0h.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=56739@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=whmunkchan@outlook.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).