From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: setq's with missing final arguments. Date: Sun, 22 Nov 2015 23:08:15 +0000 Message-ID: <20151122230815.GE2332@acm.fritz.box> References: <20151122122657.GA2332@acm.fritz.box> <065d0399-7e58-465d-b57f-5ebe91695e59@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1448233606 9509 80.91.229.3 (22 Nov 2015 23:06:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 22 Nov 2015 23:06:46 +0000 (UTC) Cc: emacs-devel@gnu.org To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 23 00:06:36 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a0diO-0000cN-5N for ged-emacs-devel@m.gmane.org; Mon, 23 Nov 2015 00:06:36 +0100 Original-Received: from localhost ([::1]:57817 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0diO-0000hO-Cy for ged-emacs-devel@m.gmane.org; Sun, 22 Nov 2015 18:06:36 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56956) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0di8-0000eH-Nm for emacs-devel@gnu.org; Sun, 22 Nov 2015 18:06:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a0di3-00057h-OK for emacs-devel@gnu.org; Sun, 22 Nov 2015 18:06:20 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:14027) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0di3-00057N-F9 for emacs-devel@gnu.org; Sun, 22 Nov 2015 18:06:15 -0500 Original-Received: (qmail 39700 invoked by uid 3782); 22 Nov 2015 23:06:13 -0000 Original-Received: from acm.muc.de (p548A57CB.dip0.t-ipconnect.de [84.138.87.203]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 23 Nov 2015 00:06:12 +0100 Original-Received: (qmail 3304 invoked by uid 1000); 22 Nov 2015 23:08:15 -0000 Content-Disposition: inline In-Reply-To: <065d0399-7e58-465d-b57f-5ebe91695e59@default> User-Agent: Mutt/1.5.23 (2014-03-12) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x X-Received-From: 193.149.48.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:195077 Archived-At: Hello, Drew. On Sun, Nov 22, 2015 at 07:52:48AM -0800, Drew Adams wrote: > > (defun bad-setq () > > "Doc string" > > (setq foo 5 > > bar)) > > In the setq, there is a missing argument after "bar". At the moment, > > the byte compiler just generates code to assign nil to bar, without > > giving any warning. IMAO, this is Very Bad. > > I propose to insert code into the byte compiler to detect and warn of > > this scenario: > It's not just the byte-compiler. This is the (erroneous, IMO) > behavior of `setq', whether interpreted or byte-compiled: > (setq bar) ; bar := nil > (setq bar) should raise an error. The doc says that `setq' > requires an even number of args. Same thing in other Lisps > (e.g., Common Lisp). Just before midnight, I think I would agree with you. With the help of the above warning facility, I have located all (six) occurrences of odd numbers of arguments to a `setq' in our sources. One was a quite nasty error, one is in .../lisp/obsolete, the other four are "coding style" thingies. It would take at least five minutes to fix them all. I now think we should make any setq with a missing value throw an error, whether in interpreted code or in the byte compiler. And I think we should do it for Emacs 25.1. John? -- Alan Mackenzie (Nuremberg, Germany).