From mboxrd@z Thu Jan 1 00:00:00 1970
Path: news.gmane.org!.POSTED!not-for-mail
From: Philipp Stephani
Newsgroups: gmane.emacs.bugs
Subject: bug#24913: 25.1.50;
Emacs accepts undocumented and confusing combinations of &optional
and &rest in argument lists
Date: Thu, 10 Nov 2016 12:58:39 +0000
Message-ID:
References:
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary=f46d0444ea695522610540f1efcb
X-Trace: blaine.gmane.org 1478782783 8707 195.159.176.226 (10 Nov 2016 12:59:43 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 10 Nov 2016 12:59:43 +0000 (UTC)
To: 24913@debbugs.gnu.org
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Nov 10 13:59:38 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 1c4owl-0006lD-22
for geb-bug-gnu-emacs@m.gmane.org; Thu, 10 Nov 2016 13:59:15 +0100
Original-Received: from localhost ([::1]:45958 helo=lists.gnu.org)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from )
id 1c4owj-0004aA-3m
for geb-bug-gnu-emacs@m.gmane.org; Thu, 10 Nov 2016 07:59:13 -0500
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41067)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from ) id 1c4owc-0004a4-90
for bug-gnu-emacs@gnu.org; Thu, 10 Nov 2016 07:59:07 -0500
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from ) id 1c4owY-0001PA-6W
for bug-gnu-emacs@gnu.org; Thu, 10 Nov 2016 07:59:06 -0500
Original-Received: from debbugs.gnu.org ([208.118.235.43]:36361)
by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
(Exim 4.71) (envelope-from )
id 1c4owY-0001P2-1z
for bug-gnu-emacs@gnu.org; Thu, 10 Nov 2016 07:59:02 -0500
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
(envelope-from ) id 1c4owX-0003i8-NG
for bug-gnu-emacs@gnu.org; Thu, 10 Nov 2016 07:59:01 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Philipp Stephani
Original-Sender: "Debbugs-submit"
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Thu, 10 Nov 2016 12:59: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.147878273714254
(code B ref 24913); Thu, 10 Nov 2016 12:59:01 +0000
Original-Received: (at 24913) by debbugs.gnu.org; 10 Nov 2016 12:58:57 +0000
Original-Received: from localhost ([127.0.0.1]:51760 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1c4owT-0003hq-E7
for submit@debbugs.gnu.org; Thu, 10 Nov 2016 07:58:57 -0500
Original-Received: from mail-wm0-f46.google.com ([74.125.82.46]:35590)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from ) id 1c4owS-0003hd-8Y
for 24913@debbugs.gnu.org; Thu, 10 Nov 2016 07:58:56 -0500
Original-Received: by mail-wm0-f46.google.com with SMTP id a197so366422680wmd.0
for <24913@debbugs.gnu.org>; Thu, 10 Nov 2016 04:58:56 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
bh=cq1Dxdtc8nuw/kFCJ611uA4QBXregfW5YARiejXijvg=;
b=oo/buhFCM+Z7U5XmBBrRa7rL52PCrfBjUmNxIEtZkGTdT24J8eD8hZ/18eeHoFig12
kwaNnfv/wcVXQp7BoFUEkGPVFWTdxgkVUVL3CW98boociE4fkuaxYmtSlKWmsbhnLJ4+
srtFzL82W5GfXLAtvgqRo5/Dq/f6ih96wwPmEfJQltfM7wJ2mMoJPy8FmHtgRavPy9vv
ewMpq9qCV6E0Vh2temaq805wYI8do4k2Auxhq+bIzJoh/EVGMoN5LZqauuM+VskgBIjH
y9bVMRU+lh+AjOLRh3JXKKV/+Tl69YxDFO84IW/A3Wj1yzV6o8sHl5DuAy4y2cycbrhT
4vsw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20130820;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to;
bh=cq1Dxdtc8nuw/kFCJ611uA4QBXregfW5YARiejXijvg=;
b=fb3T3FClyU/prJ9Kd7Xoar3D4YNL+C5pmmgSLoNdBxcEhwv9saOCqsNQgXn20fG00F
dnp0pWKNx1dLqp0IMo74nxXouwkZ2MERZFD5rXj8y+HN/hUGRcIsIawhDj5rn0z1FyZv
y7Th4cdngOUh2PEK7T1k07ipUwGpEm96mkXQf9lq6dOkbqVnbBKw3JNbD+dOkBbuX7U6
jKGbgFj0rZ/1vxL+d8ScxEYYUkJD6l+POv9B5w+V+H/SZ8PCjM4TX73NLfR38x8D6Fwk
xvFERJg8swFlYNOEFggHGihMtoQIbprssBJUkP8NAyDCCzFftFsZSaKBf16wVxMxrFj2
LyFA==
X-Gm-Message-State: ABUngvdn4LCCPra0yphNEUdl6W26+iwcQH9Ud0wnmiicNQV5CaqBkIDW9A9MHEHF5LuCBT1cyq9VJTpcekyuQA==
X-Received: by 10.194.18.196 with SMTP id y4mr4339047wjd.73.1478782730172;
Thu, 10 Nov 2016 04:58:50 -0800 (PST)
In-Reply-To:
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:125549
Archived-At:
--f46d0444ea695522610540f1efcb
Content-Type: multipart/alternative; boundary=f46d0444ea6955225c0540f1efc9
--f46d0444ea6955225c0540f1efc9
Content-Type: text/plain; charset=UTF-8
Philipp Stephani schrieb am Mi., 9. Nov. 2016 um
22:19 Uhr:
>
> For example:
>
> (funcall (lambda (&optional &rest &rest &optional x) (list x)) 'a)
> => ((a))
>
> Obviously here the &rest keyword "wins", but I think that's overly
> confusing. Such an argument list is most likely a programmer mistake,
> and should signal an error to make the programmer aware of the mistake.
>
>
Here's a patch that detects such argument lists.
--f46d0444ea6955225c0540f1efc9
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
For example:
(funcall (lambda (&optional &rest &rest &optional x) (list =
x)) 'a)
=3D> ((a))
Obviously here the &rest keyword "wins", but I think that'=
;s overly
confusing.=C2=A0 Such an argument list is most likely a programmer mistake,=
and should signal an error to make the programmer aware of the mistake.
Here's a patch that detects such argum=
ent lists.=C2=A0
--f46d0444ea6955225c0540f1efc9--
--f46d0444ea695522610540f1efcb
Content-Type: text/plain; charset=US-ASCII; name="0001-Prevent-dubious-argument-lists.txt"
Content-Disposition: attachment;
filename="0001-Prevent-dubious-argument-lists.txt"
Content-Transfer-Encoding: base64
Content-ID: <1584e509a67ee7059201>
X-Attachment-Id: 1584e509a67ee7059201
RnJvbSAxODU1ODZhMzM3N2UxNjZhNTEyMzQwNzc5OWFiNzc0MWQ0NjI3YzUyIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBQaGlsaXBwIFN0ZXBoYW5pIDxwaHN0QGdvb2dsZS5jb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