unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Michael Heerdegen <michael_heerdegen@web.de>,
	Gemini Lasswell <gazally@runbox.com>,
	46573@debbugs.gnu.org
Subject: bug#46573: 28.0.50; Error when edebugging setting unbound place
Date: Tue, 16 Feb 2021 19:00:45 -0500	[thread overview]
Message-ID: <jwvczwzy3p2.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <8735xvr4o2.fsf@gnus.org> (Lars Ingebrigtsen's message of "Wed, 17 Feb 2021 00:09:17 +0100")

>>> (put 'gv-place 'edebug-form-spec '(form)) ;So-called "indirect spec".
>>>
>>> That's certainly not correct for the simplest forms like
>>
>> This has been there since the introduction of `gv`, so I think it
>> *is* correct.  The problem is elsewhere (likely introduced by some of
>> my recent changes to Edebug).
>
> Darn!  I thought I had finally learned how to read edebug specs.  :-/  I
> though `form' meant that it's going to be instrumented?  Hm...  but it's
> `(form)' which means, er, uhm.

Yes, it means Edebug rewrites (setf x 5) to something like:

    (edebug-after (edebug-before 1) 3 (setf (edebug-after 0 2 x) 5))

Whose behavior then depends on the definition of (edebug-after N1 N2 EXP)
as a "place", which is here:

    (put 'edebug-after 'gv-expander
         (lambda (do before index place)
           (gv-letplace (getter setter) place
             (funcall do `(edebug-after ,before ,index ,getter)
                      (lambda (store)
                        `(progn (edebug-after ,before ,index ,getter)
                                ,(funcall setter store)))))))

and indeed, there's the bug, introduced by Gemini's commit
d79cf638f278e50c22feb53d6ba556f5ce9d7853 which does (among various other
things):

    [...]
    * lisp/emacs-lisp/gv.el: Modify edebug-after's gv-expander to
    instrument in the setter as well as the getter.
    [...]

    diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el
    --- a/lisp/emacs-lisp/gv.el
    +++ b/lisp/emacs-lisp/gv.el
    @@ -302,5 +302,7 @@
     (put 'edebug-after 'gv-expander
          (lambda (do before index place)
            (gv-letplace (getter setter) place
              (funcall do `(edebug-after ,before ,index ,getter)
    -                  setter))))
    +                  (lambda (store)
    +                    `(progn (edebug-after ,before ,index ,getter)
    +                            ,(funcall setter store)))))))

Gemini, how important is it to instrument the setter?  It is definitely
undesirable for Edebug, which you end up seeing the result of
computations which don't take place at all during
un-instrumented execution.  How 'bout using something like

    `(edebug-after ,before ,index ,(funcall setter store))

instead?


        Stefan






  parent reply	other threads:[~2021-02-17  0:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16 22:32 bug#46573: 28.0.50; Error when edebugging setting unbound place Michael Heerdegen
2021-02-16 22:51 ` Lars Ingebrigtsen
2021-02-16 23:04   ` Stefan Monnier
2021-02-16 23:09     ` Lars Ingebrigtsen
2021-02-16 23:19       ` Lars Ingebrigtsen
2021-02-16 23:21         ` Lars Ingebrigtsen
2021-02-17 15:29           ` Eli Zaretskii
2021-03-01 21:17             ` Stefan Monnier
2021-03-02  5:58               ` Eli Zaretskii
2021-03-05 17:39                 ` Stefan Monnier
2021-03-03 23:13               ` Michael Heerdegen
2021-03-03 23:26                 ` Stefan Monnier
2021-03-03 23:47                   ` Michael Heerdegen
2021-02-17  0:00       ` Stefan Monnier [this message]
2021-02-24  0:59         ` Gemini Lasswell

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=jwvczwzy3p2.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=46573@debbugs.gnu.org \
    --cc=gazally@runbox.com \
    --cc=larsi@gnus.org \
    --cc=michael_heerdegen@web.de \
    /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).