From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Gemini Lasswell Newsgroups: gmane.emacs.bugs Subject: bug#24913: 25.1.50; Emacs accepts undocumented and confusing combinations of &optional and &rest in argument lists Date: Sat, 19 Nov 2016 22:31:21 -0800 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1479623537 18962 195.159.176.226 (20 Nov 2016 06:32:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 20 Nov 2016 06:32:17 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (darwin) Cc: 24913@debbugs.gnu.org To: Philipp Stephani Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 20 07:32:12 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c8Lfg-0003LG-8G for geb-bug-gnu-emacs@m.gmane.org; Sun, 20 Nov 2016 07:32:12 +0100 Original-Received: from localhost ([::1]:43831 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c8Lff-0002Qs-Bx for geb-bug-gnu-emacs@m.gmane.org; Sun, 20 Nov 2016 01:32:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c8LfZ-0002Q3-Ry for bug-gnu-emacs@gnu.org; Sun, 20 Nov 2016 01:32:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c8LfV-0002Vq-VL for bug-gnu-emacs@gnu.org; Sun, 20 Nov 2016 01:32:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48355) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c8LfV-0002Vj-S5 for bug-gnu-emacs@gnu.org; Sun, 20 Nov 2016 01:32:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1c8LfV-0004Wm-JK for bug-gnu-emacs@gnu.org; Sun, 20 Nov 2016 01:32:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gemini Lasswell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 20 Nov 2016 06:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24913 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24913-submit@debbugs.gnu.org id=B24913.147962348917360 (code B ref 24913); Sun, 20 Nov 2016 06:32:01 +0000 Original-Received: (at 24913) by debbugs.gnu.org; 20 Nov 2016 06:31:29 +0000 Original-Received: from localhost ([127.0.0.1]:35521 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c8Lez-0004Vw-7v for submit@debbugs.gnu.org; Sun, 20 Nov 2016 01:31:29 -0500 Original-Received: from aibo.runbox.com ([91.220.196.211]:52804) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c8Lex-0004Vl-8N for 24913@debbugs.gnu.org; Sun, 20 Nov 2016 01:31:27 -0500 Original-Received: from [10.9.9.211] (helo=mailfront11.runbox.com) by bars.runbox.com with esmtp (Exim 4.71) (envelope-from ) id 1c8Lev-0002aX-QR; Sun, 20 Nov 2016 07:31:25 +0100 Original-Received: from c-24-22-244-161.hsd1.wa.comcast.net ([24.22.244.161] helo=rainbow.local) by mailfront11.runbox.com with esmtpsa (uid:179284 ) (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) id 1c8Leu-0003CP-Cz; Sun, 20 Nov 2016 07:31:24 +0100 In-Reply-To: (Philipp Stephani's message of "Sat, 19 Nov 2016 16:40:47 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:125891 Archived-At: Philipp Stephani 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.