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: "Gerd Möllmann" <gerd.moellmann@gmail.com>
Cc: "Michael Heerdegen" <michael_heerdegen@web.de>,
	brandon.irizarry@gmail.com,
	"Mattias Engdegård" <mattias.engdegard@gmail.com>,
	"Michael Albinus" <michael.albinus@gmx.de>,
	65344@debbugs.gnu.org
Subject: bug#65344: 28.2; Unable to Edebug cl-flet form which uses argument destructuring
Date: Sat, 02 Sep 2023 13:04:57 -0400	[thread overview]
Message-ID: <jwvzg24tss8.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <m2r0nh88js.fsf@Mini.fritz.box> ("Gerd Möllmann"'s message of "Sat, 02 Sep 2023 07:10:15 +0200")

>>> The problem seems to be the attempt to first match the spec
>>>
>>>   (&define [&name symbolp "@cl-flet@"]
>>>            [&name [] gensym] ;Make it unique!
>>>            def-form)])
>>
>> I think this is not right:
>>
>> - `def-form` is for use by forms which will be run "later", meaning that
>>   we can start executing those instrumented form while running
>>   non-instrumented code  (like the inside of a lambda), so it should not
>>   be needed here: we should use just `form`.
>
> I don't think I get that yet.  Let's say we have
>
>   (cl-flet ((f (lambda () (list 1 2))))
>     (f))
>
> In this case, the code for F will be run in the body of the
> flet. Doesn't that qualify as being run later, as you describe above, 
> ignoring the "non-instrumented" part, maybe?

No, in the above case the `def-form` is

    (lambda () (list 1 2))

which will be "run" right when we enter the `cl-flet` ("run" is an
exaggeration here since this lambda is a constant so it'll just
self-evaluate) and not when `f` is called.

> (Just from the perspective of behaviour, C-u C-M-x on the flet above does
> seem to do what I'd expect: the call to F let's me step into the
> body of the lambda.)

Yes, it is harmless for debugging purposes (at most it makes things ever
so slightly less efficient by having to process a few more
`edebug-enter`s than needed).

>> - The &define+&name isn't quite right here.  In `(cl-flet ((F EXP)) ...)`
>>   it tells Edebug that EXP should be given the name F whereas the `cl-flet`
>>   actually gives the name F to the value returned by EXP.
>>   [ In terms of code coverage, F will then always be considered as
>>     covered just because we have to execute EXP in order to discover the
>>     function to bind to F.  ]
>>
>> I think that's why the old code had just `(symbolp form)`:
>> it's difficult with `(cl-flet ((F EXP)) ...)` to give a name to the
>> right thing :-(
>
> I'm afraid I know nothing about coverage, so I can't say something
> halfways intelligent to that.

The whole `&name` business is of no use for the single-step debugger,
it's only useful for other uses of the instrumentation such as
code-coverage.


        Stefan






  reply	other threads:[~2023-09-02 17:04 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-16 18:21 bug#65344: 28.2; Unable to Edebug cl-flet form which uses argument destructuring Brandon Irizarry
2023-08-17  0:55 ` Michael Heerdegen
2023-08-17  5:29 ` Gerd Möllmann
2023-08-17 15:42   ` Brandon Irizarry
2023-08-17 15:56     ` Eli Zaretskii
2023-08-17 18:23     ` Gerd Möllmann
2023-08-17 23:07       ` Michael Heerdegen
2023-08-18  5:19         ` Gerd Möllmann
2023-08-18  5:58           ` Michael Heerdegen
2023-08-18  6:43             ` Gerd Möllmann
2023-08-19  8:08               ` Gerd Möllmann
2023-08-20  3:57                 ` Michael Heerdegen
2023-08-20  5:32                   ` Gerd Möllmann
2023-08-20  6:08                     ` Michael Heerdegen
2023-08-20  6:48                       ` Gerd Möllmann
2023-08-21  1:19                         ` Michael Heerdegen
2023-08-21  7:01                           ` Gerd Möllmann
2023-08-21  7:10                             ` Gerd Möllmann
2023-08-21  7:30                               ` Gerd Möllmann
2023-08-22  0:54                                 ` Michael Heerdegen
2023-08-22  5:48                                   ` Gerd Möllmann
2023-08-22  6:10                                     ` Michael Heerdegen
2023-08-22  8:05                                       ` Gerd Möllmann
2023-08-22 21:06                                         ` Brandon Irizarry
2023-08-23  0:35                                           ` Michael Heerdegen
2023-08-23  0:32                                         ` Michael Heerdegen
2023-08-23  1:25                                           ` Drew Adams
2023-08-23  6:06                                             ` Gerd Möllmann
2023-08-23 14:23                                               ` Drew Adams
2023-08-24  3:16                                                 ` Michael Heerdegen
2023-08-24  9:10                                                 ` Gerd Möllmann
2023-08-24 23:04                                                   ` Michael Heerdegen
2023-08-25  1:53                                                     ` Drew Adams
2023-08-25  4:07                                                       ` Michael Heerdegen
2023-08-25 14:50                                                         ` Drew Adams
2023-08-26  0:16                                                           ` Michael Heerdegen
2023-08-26  2:02                                                             ` Drew Adams
2023-08-20  4:39                 ` Michael Heerdegen
2023-08-20  5:15                   ` Gerd Möllmann
2023-08-23  9:25 ` Mattias Engdegård
2023-08-23  9:31   ` Mattias Engdegård
2023-08-23 11:10     ` Gerd Möllmann
2023-08-23 14:08       ` Gerd Möllmann
2023-08-24  1:14         ` Michael Heerdegen
2023-08-24  6:17           ` Gerd Möllmann
2023-08-25  4:10             ` Michael Heerdegen
2023-08-25  6:19               ` Gerd Möllmann
2023-08-25  4:22             ` Michael Heerdegen
2023-08-25  6:33               ` Gerd Möllmann
2023-08-25 17:53                 ` Michael Heerdegen
2023-08-26  5:39                   ` Gerd Möllmann
2023-08-27  4:02                     ` Michael Heerdegen
2023-08-27  6:34                       ` Gerd Möllmann
2023-09-01 23:24         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-02  5:10           ` Gerd Möllmann
2023-09-02 17:04             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-09-02 19:27               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-03  5:51                 ` Gerd Möllmann
2023-09-03 16:09                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-03 16:47                     ` Gerd Möllmann
2023-09-04 21:14                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-23  9:33   ` Gerd Möllmann

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=jwvzg24tss8.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=65344@debbugs.gnu.org \
    --cc=brandon.irizarry@gmail.com \
    --cc=gerd.moellmann@gmail.com \
    --cc=mattias.engdegard@gmail.com \
    --cc=michael.albinus@gmx.de \
    --cc=michael_heerdegen@web.de \
    --cc=monnier@iro.umontreal.ca \
    /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).