From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#65344: 28.2; Unable to Edebug cl-flet form which uses argument destructuring Date: Sat, 02 Sep 2023 13:04:57 -0400 Message-ID: References: <5184DD53-F121-405D-AEE9-6E72E17127EA@gmail.com> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27627"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Michael Heerdegen , brandon.irizarry@gmail.com, Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , Michael Albinus , 65344@debbugs.gnu.org To: Gerd =?UTF-8?Q?M=C3=B6llmann?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 02 19:06:12 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qcU4Y-0006z4-Qe for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Sep 2023 19:06:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcU4I-0003xx-2l; Sat, 02 Sep 2023 13:05:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qcU4G-0003xk-Vg for bug-gnu-emacs@gnu.org; Sat, 02 Sep 2023 13:05:52 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qcU4G-0007vY-Nk for bug-gnu-emacs@gnu.org; Sat, 02 Sep 2023 13:05:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qcU4Q-00055d-6W for bug-gnu-emacs@gnu.org; Sat, 02 Sep 2023 13:06:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 Sep 2023 17:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65344 X-GNU-PR-Package: emacs Original-Received: via spool by 65344-submit@debbugs.gnu.org id=B65344.169367431819511 (code B ref 65344); Sat, 02 Sep 2023 17:06:02 +0000 Original-Received: (at 65344) by debbugs.gnu.org; 2 Sep 2023 17:05:18 +0000 Original-Received: from localhost ([127.0.0.1]:38520 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qcU3h-00054d-QV for submit@debbugs.gnu.org; Sat, 02 Sep 2023 13:05:18 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:8590) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qcU3f-00054K-Gf for 65344@debbugs.gnu.org; Sat, 02 Sep 2023 13:05:16 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id CD5258076B; Sat, 2 Sep 2023 13:04:59 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1693674298; bh=4xbcI/mTZIBpia8WSGeM5bhcYbZrV2aed3IiquFwUZw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=LyrIMYq9irov9pGkuEiSp5/YUEwyFnGbi607PLou9ujkXozTCzA0s3PhkDRohRCzP +dsYKU1SpGZmokzdc2oujMBdFhr7F3dPQoZ3emiD65TqKQ7rpP2cIwwxKWqAyGDn1w qezp++yz/qkLeqnFrQ66QC3PEnc6Zhrdxf+aTs0m5RloD28NA48WGOZ83MRSyPERMN Itl4AfxYew/AxvFXOIUlrAjk3p6kBNycHw228EuaR1imDZM1RjddkGRCcr4FCw/n/X AYf92ZPbPFsqIPg/RK5T4nmpQJKHcYF7T0jecfa/URKyvKLlEBrCotqqp31MBTxlRn p538zU4xvGfaA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 6EA42801B3; Sat, 2 Sep 2023 13:04:58 -0400 (EDT) Original-Received: from pastel (unknown [45.72.228.218]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 39525120903; Sat, 2 Sep 2023 13:04:58 -0400 (EDT) In-Reply-To: ("Gerd =?UTF-8?Q?M=C3=B6llmann?="'s message of "Sat, 02 Sep 2023 07:10:15 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:269032 Archived-At: >>> 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