From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani
Philipp Stephani <p.stephani2@gmail.com> wr= ites:
>=C2=A0 A more general solution would be to have the byte compiler try t= o match
>=C2=A0 Edebug specs, and issue a warning or an error if it fails. That = would
>=C2=A0 help find errors in the invocations of all macros, not just ones= with
>=C2=A0 argument lists.
>
> I don't understand how this is related. This is only about functio= n
> definitions in the evaluator and the byte compiler. I don't see ho= w
> Edebug could help here.
Edebug specs describe the expected syntax for the arguments of a macro,
including the macros which define functions, such as lambda, defun,
defmacro etc. If Edebug can't match the actual arguments in a macro
invocation to the Edebug spec for that macro, it will signal an error.
For an example of Edebug catching a misplaced &optional in an argument<= br class=3D"gmail_msg"> list, see bug#24762.
So part of my suggestion is that since there exists in Emacs a powerful
mechanism for checking macro argument lists, it would be better to use
it if we want to let programmers know that their macro invocations are
incorrect, instead of adding error checking to individual macros on a
case by case basis.
Another thought going into this suggestion is my observation that it's<= br class=3D"gmail_msg"> not difficult to find bugs in Edebug specs in the Emacs sources right
now. One cause of that could be the Edebug spec documentation, which
could be improved. But I think the primary reason is that a macro with a
broken Edebug spec won't cause an error until someone tries to use
Edebug or Testcover on an invocation of that macro, which maybe isn't common practice when reviewing changes. But if the byte compiler checked
Edebug specs and signaled errors, then at least those errors in Edebug
specs which can be found statically would be noticed immediately.