From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Brandon Irizarry Newsgroups: gmane.emacs.bugs Subject: bug#65344: 28.2; Unable to Edebug cl-flet form which uses argument destructuring Date: Tue, 22 Aug 2023 17:06:24 -0400 Message-ID: References: <040fe8aa-7a15-762c-e710-eb85f997d329@gmail.com> <871qg1tghr.fsf@web.de> <012813c5-cfc3-7ba9-5e84-70d79c172e77@gmail.com> <87zg2oyjre.fsf@web.de> <8b7fc1c2-ae6c-b825-c772-38b18ddb67d6@gmail.com> <877cpqs6vi.fsf@web.de> <87wmxqs0ti.fsf@web.de> <616b60fc-9f68-14ae-d262-716eb0cc685d@gmail.com> <87h6ot19av.fsf@web.de> <878ra3q4kk.fsf@web.de> <87il97obdi.fsf@web.de> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000008927d60603895e36" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23660"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Michael Heerdegen , 65344@debbugs.gnu.org, Eli Zaretskii 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 Tue Aug 22 23:07:20 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 1qYYat-00060M-CN for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Aug 2023 23:07:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYYab-0003Yt-Qr; Tue, 22 Aug 2023 17:07:01 -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 1qYYaZ-0003YO-6h for bug-gnu-emacs@gnu.org; Tue, 22 Aug 2023 17:06:59 -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 1qYYaY-000374-Ug for bug-gnu-emacs@gnu.org; Tue, 22 Aug 2023 17:06:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qYYab-0000AL-II for bug-gnu-emacs@gnu.org; Tue, 22 Aug 2023 17:07:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Brandon Irizarry Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Aug 2023 21:07:01 +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.1692738404600 (code B ref 65344); Tue, 22 Aug 2023 21:07:01 +0000 Original-Received: (at 65344) by debbugs.gnu.org; 22 Aug 2023 21:06:44 +0000 Original-Received: from localhost ([127.0.0.1]:60538 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYYaJ-00009c-IO for submit@debbugs.gnu.org; Tue, 22 Aug 2023 17:06:44 -0400 Original-Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]:59838) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYYaH-00009H-4F for 65344@debbugs.gnu.org; Tue, 22 Aug 2023 17:06:41 -0400 Original-Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2bcd7a207f7so8360381fa.3 for <65344@debbugs.gnu.org>; Tue, 22 Aug 2023 14:06:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692738392; x=1693343192; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=d5CoAtIJfOmo3TEtYf+x5OpOlISzjS0VG8UabPdzdY0=; b=VEEwR5QXreukLt7uCO3P9n5jNZ16Ch5w8pCJSL75k4eNuRYYLtGwYSKBEvhUhALgei K2ByTzfig56qD8oyfb72hvY/VkbGB9qI7srM7Wjna3tIGHbJ2DPRMtgnfH8eYIaZ2Z5u OeoaX2tv9EpKHseNUlVonwVIeCUS4tTLaTNo7lJS5jF3ENxKaxR08+pYW5QbRud6/T42 I6Z2uGSMpBoNBtOHZGiWixWHXNylaetIZUkbeOZNzNo+fj53J1BAXQB+HpocqgYt4i5n NHwO796F0kCF4Vdyk2nyL+Ha++IN7nMjy/DF1MekU8rxMziibc9QCfmuTC+zD5TdCffh IcQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692738392; x=1693343192; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=d5CoAtIJfOmo3TEtYf+x5OpOlISzjS0VG8UabPdzdY0=; b=FWSwKep0J2Atf+vj8uFCvj/F99ARigHUtGr+W14y0pvajzae+ioxRwIBfi1jCB6IdJ Tv5POVX59CfolTovOKXdSPocYjlsV7/hddyHE+tfIc8y0HmVsVPcpb4VsxgX0mNlCZUS rMd+N3KXqxOIttFkk47G8fHg3uMpNBf+Sp6J660ipIqAMAAkK+SLIKVbzzQ0Lm6ftqAr l7K5ikbCHVPrKX+Fwa0IUqqZ32Il7bOAA5I8jf6rgKSaUlMl2LnYn0GXpQYbRhB285Kv YB2lMxLDkVUPmdBzb8eQFn6+HrV1G9nSjhgWpnJ1rUmKCPhTA1BX6jwkQpCkNVQBrhJ2 rMDQ== X-Gm-Message-State: AOJu0Yz+X4fEitOIfWVR7hrntXo9ajsIKmnxhotYF5jjRAGf2ooeGAqq dcJkKkehKnBNbEApGTxZbAVTgD0z9sgiJNeHOuI= X-Google-Smtp-Source: AGHT+IEbbQqXU0f0J21vSczRWluUksb4pHVbsjquCO2bvaJkCPRDUyxcVskPJOgrhyffV7dIGasFxrSwx9PZTeHRxzs= X-Received: by 2002:a2e:2404:0:b0:2b6:df8a:d44b with SMTP id k4-20020a2e2404000000b002b6df8ad44bmr7376190ljk.36.1692738391712; Tue, 22 Aug 2023 14:06:31 -0700 (PDT) In-Reply-To: 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:268187 Archived-At: --0000000000008927d60603895e36 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi all, First, thanks for all the attention this has received. Eli, your comments are duly noted. Trying my best to follow this thread, I took the patch submitted by Gerd, pasted it in my scratch buffer, renamed the macro 'my-cl-flet', but switched the order of the two '&define' clauses. I evaluated this macro and started using it on some small test cases, which check out. I believe I may merely be echoing Gerd's comment about exchanging the two debug specs, but I wanted to flesh this aspect out a bit more thoroughly in case. Note that I've used Org source blocks (which I've noticed people have been doing), since I suspect people are reading this thread in Emacs itself, and can subsequently avail themselves of this format. Under 'emacs -Q': #+begin_src emacs-lisp (require 'cl-macs) ;; insert 'my-cl-flet' macro definition here (my-cl-flet ((cool-fn ((min max)) (cons min max))) (cool-fn '(2 3))) #+end_src Edebug here runs as smooth as butter. Nice! Next, I tried another example mentioned in this thread: #+begin_src emacs-lisp (defun make-fun (n) (message "the function") (lambda () n)) (defvar k 17) (my-cl-flet ((a (make-fun k))) ;; `make-fun' call not instrumented (a)) #+end_src Again, everything looks good. Finally, a more conventional example: #+begin_src emacs-lisp (my-cl-flet ((fn (a b) (cons a b))) (fn 1 2)) #+end_src Works out, as expected. So it looks like we may have a happy ending after all? WDYT? On Tue, Aug 22, 2023 at 4:05=E2=80=AFAM Gerd M=C3=B6llmann wrote: > Michael Heerdegen writes: > > > Gerd M=C3=B6llmann writes: > > > >> I wonder if this isn't a bug in cl-flet itself. If you change the nam= es > >> a bit, this is > >> > >> (cl-flet ((fn (a b))) > >> ...) > >> > >> which is a perfectly valid local definition of FN with two parameter A > >> and B, returning nil in CL. It signals an error in Emacs which I'd > >> consider a bug. > > > > It's a known limitation, AFAIR. It's more important to support the > > (SYMBOL EXPR) than this corner case, and we don't want to guess "what i= s > > meant", so a binding of two elements is always interpreted this way in > > Elisp. This problem has been discussed a while ago. > > That's quite unfortunate :-(. I wish that whole extension would be at > least be deprecated. > > I'll exchange the two debug specs then. ATM, I don't see how to test > that though. That's also unfortunate. > > > Hmm, right...but where did I see it. Oh, I remember, it was > > `cl-defmethod' that supports such names. > > Looks like it does, indeed, by constructing a symbol. One couldn't tell > from the doc string :-). > --0000000000008927d60603895e36 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi all,

First, thanks f= or all the attention this has received. Eli, your comments are duly noted.<= /div>

Trying my best to follow this thread, I took the p= atch submitted by Gerd, pasted it in my scratch buffer, ren= amed the macro 'my-cl-flet', but switched the order of the two '= ;&define' clauses. I evaluated this macro and started using it on s= ome small test cases, which check out. I believe I may merely be echoing Ge= rd's comment about exchanging the two debug specs, but I wanted to fles= h this aspect out a bit more thoroughly in case. Note that I've used Or= g source blocks (which I've noticed people have been doing), since I su= spect people are reading this thread in Emacs itself, and can subsequently = avail themselves of this format.

Under 'em= acs -Q':

#+begin_src emacs-lisp
= (require 'cl-macs)

;; insert 'my-cl-f= let' macro definition here

(my-cl-flet ((cool-= fn ((min max))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 (cons min max)))
=C2=A0 (cool-fn '(2 3)))
=
#+end_src

Edebug here runs as smooth as butte= r. Nice!

Next, I tried another example mentioned i= n this thread:

#+begin_src emacs-lisp
(defun make-fun (n)
=C2=A0 (message "the function")
=C2= =A0 (lambda () n))

(defvar k 17)

(my-cl-flet ((a (make-fun k)= )) ;; `make-fun' call not instrumented
=C2=A0 (a))
#+e= nd_src

Again, everything looks good. Finally, a mo= re conventional example:

#+begin_src emacs-lisp
(my-cl-flet ((fn (a b)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(cons a b)))
=C2=A0 (fn 1 2))
#+end= _src

Works out, as expected. So it looks like we m= ay have a happy ending after all?

WDYT?

On Tue, Aug 22, 2023 at 4:05=E2=80=AFAM Gerd M=C3=B6llmann <gerd.moellmann@gmail.com> wrote= :
Michael Heerde= gen <micha= el_heerdegen@web.de> writes:

> Gerd M=C3=B6llmann <gerd.moellmann@gmail.com> writes:
>
>> I wonder if this isn't a bug in cl-flet itself.=C2=A0 If you c= hange the names
>> a bit, this is
>>
>> (cl-flet ((fn (a b)))
>>=C2=A0 =C2=A0...)
>>
>> which is a perfectly valid local definition of FN with two paramet= er A
>> and B, returning nil in CL.=C2=A0 It signals an error in Emacs whi= ch I'd
>> consider a bug.
>
> It's a known limitation, AFAIR.=C2=A0 It's more important to s= upport the
> (SYMBOL EXPR) than this corner case, and we don't want to guess &q= uot;what is
> meant", so a binding of two elements is always interpreted this w= ay in
> Elisp.=C2=A0 This problem has been discussed a while ago.

That's quite unfortunate :-(.=C2=A0 I wish that whole extension would b= e at
least be deprecated.

I'll exchange the two debug specs then.=C2=A0 ATM, I don't see how = to test
that though.=C2=A0 That's also unfortunate.

> Hmm, right...but where did I see it.=C2=A0 Oh, I remember, it was
> `cl-defmethod' that supports such names.

Looks like it does, indeed, by constructing a symbol.=C2=A0 One couldn'= t tell
from the doc string :-).
--0000000000008927d60603895e36--