bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#65344: 28.2; Unable to Edebug cl-flet form which uses argument destr


From: Stefan Monnier
Subject: bug#65344: 28.2; Unable to Edebug cl-flet form which uses argument destructuring
Date: Sun, 03 Sep 2023 12:09:53 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

>>                          (prog1
>>                              #'(lambda (y)
>>                                 (edebug-enter 'edebug-anon5 (list y)
>>                                  #'(lambda nil :closure-dont-trim-context
>>                                     (edebug-after (edebug-before 0) 3
>
> And here again the same mechanism, but with a bogus name.  That's what
> you are referring to, right?

While in this specific case it would be technically possible to give it
a better name, it's somewhere between hard and impossible to do it in
general, so I'm not bothered by this "bogus name": that's already what
is used in all other cases where anonymous functions are encountered.

> Do you perhaps an idea how to solve that?

I'm proposing we revert to the code we had originally, which avoids
creating the spurious `f@cl-flet@4`.
[ Tho with extra comments to explain why there's no `&name` on the
  (symbolp form) case.  ]

After all, your original report was due to a misunderstanding, thinking
that `(cl-flet ((a ((b c)))) body)` treated `((b c))` as an arg list
(for a function with an empty body) like Common Lisp's `flet` does,
whereas `cl-flet` treats it as an expression (that returns the function).


        Stefan


diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 850fbc69180..8d92acb0c95 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -2075,15 +2075,16 @@ cl-flet
 
 \(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
   (declare (indent 1)
-           (debug ((&rest [&or (&define [&name symbolp "@cl-flet@"]
+           ;; The first (symbolp form) case doesn't use `&name' because
+           ;; it's hard to associate this name with the body of the function
+           ;; that `form' will return (bug#65344).
+           (debug ((&rest [&or (symbolp form)
+                               (&define [&name symbolp "@cl-flet@"]
                                         [&name [] gensym] ;Make it unique!
                                         cl-lambda-list
                                         cl-declarations-or-string
                                         [&optional ("interactive" interactive)]
-                                        def-body)
-                               (&define [&name symbolp "@cl-flet@"]
-                                        [&name [] gensym] ;Make it unique!
-                                        def-form)])
+                                        def-body)])
                    cl-declarations body)))
   (let ((binds ()) (newenv macroexpand-all-environment))
     (dolist (binding bindings)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]