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: Gerd Möllmann
Subject: bug#65344: 28.2; Unable to Edebug cl-flet form which uses argument destructuring
Date: Fri, 18 Aug 2023 07:19:29 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.14.0

On 18.08.23 01:07, Michael Heerdegen wrote:
Gerd Möllmann <gerd.moellmann@gmail.com> writes:

Not remembering much about Edebug, but cl-defun seems to work with
Edebug.  So... :-)

Yes, this problem does not concern `cl-defun'.  This is the Edebug spec
of `cl-flet':

#+begin_src emacs-lisp
((&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)])
  cl-declarations body)
#+end_src

Instrumenting a binding first tries (symbolp form): This is the syntax
where you can specify an expression to evaluate whose result is then
fbound.  Although we obviously have three elements to match in the
recipe case, Edebug tries nonetheless, and FORM raises an error because
it can't match ((min max)).  It should just cause backtracking, but the
implementation disables backtracking by purpose.

When you replace (symbolp form) with (symbolp sexp) the problem is gone.
But that only silences the problem: this also disables the
instrumentation of a form in that position.

I'm too dumb to fix this correctly.  We could transpose the two &or
branches in the spec, this works but it is also only a way to avoid the
problem.

Thanks.

The corresponding declaration of cl-defun is

     (&define [&name sexp]   ;Allow (setf ...) additionally to symbols.
              cl-lambda-list
              cl-declarations-or-string
              [&optional ("interactive" interactive)]
              def-body)

which I would naively expect to be suitable for a single function in an flet/labels. (Maybe without the (setf ...) case, I'm not sure ATM).
Do you perhaps have an insight why there are two &name in the flet spec?

Also naively asked, what does the &or in the flet case mean? Does it say that that the elements of the flet can either be symbols or functions? A symbol element doesn't make much sense to me. Do you perhaps have a clue what that is?







reply via email to

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