From: Philipp Stephani <p.stephani2@gmail.com>
To: Gemini Lasswell <gazally@runbox.com>
Cc: 24913@debbugs.gnu.org
Subject: bug#24913: 25.1.50; Emacs accepts undocumented and confusing combinations of &optional and &rest in argument lists
Date: Sun, 20 Nov 2016 12:41:02 +0000 [thread overview]
Message-ID: <CAArVCkTcRW-c-fdi4W_-aiSuBqS_LQaEt6nNeXs-jfDkNeeeEw@mail.gmail.com> (raw)
In-Reply-To: <m2shqmachy.fsf@rainbow.local>
[-- Attachment #1: Type: text/plain, Size: 2271 bytes --]
Gemini Lasswell <gazally@runbox.com> schrieb am So., 20. Nov. 2016 um
07:31 Uhr:
> Philipp Stephani <p.stephani2@gmail.com> writes:
>
> > A more general solution would be to have the byte compiler try to match
> > Edebug specs, and issue a warning or an error if it fails. That would
> > help find errors in the invocations of all macros, not just ones with
> > argument lists.
> >
> > I don't understand how this is related. This is only about function
> > definitions in the evaluator and the byte compiler. I don't see how
> > 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
> 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
> 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.
>
Integrating Edebug checks, byte-compiler checks, and evaluator checks
sounds like the right thing to do, but also like a huge amount of work that
is out of scope for this bug. Please create a new bug if you want that.
Note that a generic checker would still need to catch cases such as
(funcall (function (lambda (&rest))) ())
that don't involve any macros.
[-- Attachment #2: Type: text/html, Size: 3414 bytes --]
next prev parent reply other threads:[~2016-11-20 12:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-09 21:17 bug#24913: 25.1.50; Emacs accepts undocumented and confusing combinations of &optional and &rest in argument lists Philipp Stephani
2016-11-10 12:58 ` Philipp Stephani
2016-11-10 16:56 ` Gemini Lasswell
2016-11-19 16:40 ` Philipp Stephani
2016-11-20 6:31 ` Gemini Lasswell
2016-11-20 12:41 ` Philipp Stephani [this message]
2016-11-18 9:06 ` Eli Zaretskii
2016-11-18 17:37 ` Philipp Stephani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAArVCkTcRW-c-fdi4W_-aiSuBqS_LQaEt6nNeXs-jfDkNeeeEw@mail.gmail.com \
--to=p.stephani2@gmail.com \
--cc=24913@debbugs.gnu.org \
--cc=gazally@runbox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.