Subject: Re: bug#28747: 26.0.60; Usage of "&rest body" in Edebug specs

From: Lars Ingebrigtsen <[email-masked]>
Date: Wed, 16 Oct 2019 04:45:40 +0200

Gemini Lasswell <[email-masked]> writes:

> The symbol &rest in an Edebug spec has a different meaning than it has
> in an argument list. In particular, "&rest body" in an Edebug spec is
> erroneous usage because it is asking Edebug to match something that
> can match nothing (body) as many times as it can, which makes an
> infinite loop.

[...]

> Here are the macros I've found that have this incorrect usage of &rest
> in their Edebug specs:
>
> crm--completion-command
> easy-mmode-define-navigation
> inline--letlisteval
> inline--leteval
> ses--letref

I've now fixed these.

> Edebug specs have been using &rest for a really long time and it
> mostly gets used correctly. But &repeat would be better, since it
> actually describes the functionality and doesn't have a completely
> different and more common usage in argument lists.
>
> Here's a little example of what an Edebug spec would look like with
> &repeat in place of &rest:
>
> (defmacro msgmac (&rest args)
>   (declare (debug ("start" [&repeat "middle"] "end")))
>   `(message "%s" ',args))
>
> (defun use-msgmac ()
>   (msgmac start end)
>   (msgmac start middle end)
>   (msgmac start middle middle end))
>
> Does anyone have thoughts on the idea of adding &repeat as a synonym
> for &rest in Edebug specs, with the goal of moving &rest towards
> obsolescence eventually?

I agree that this would be a lot clearer and probably less error-prone
than &rest.

Does anybody have an opinion here?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no