From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: setq's with missing final arguments. Date: Sun, 22 Nov 2015 14:08:22 +0100 Message-ID: <87h9ke9o6x.fsf@fencepost.gnu.org> References: <20151122122657.GA2332@acm.fritz.box> <87egfi5h8i.fsf@igel.home> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1448197722 10864 80.91.229.3 (22 Nov 2015 13:08:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 22 Nov 2015 13:08:42 +0000 (UTC) Cc: Alan Mackenzie , emacs-devel@gnu.org To: Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 22 14:08:41 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 1a0UNj-0007Jl-KA for ged-emacs-devel@m.gmane.org; Sun, 22 Nov 2015 14:08:39 +0100 Original-Received: from localhost ([::1]:55999 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0UNj-00086i-Kv for ged-emacs-devel@m.gmane.org; Sun, 22 Nov 2015 08:08:39 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0UNV-0007yW-1X for emacs-devel@gnu.org; Sun, 22 Nov 2015 08:08:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a0UNU-000236-5b for emacs-devel@gnu.org; Sun, 22 Nov 2015 08:08:24 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42432) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0UNU-00022v-2w; Sun, 22 Nov 2015 08:08:24 -0500 Original-Received: from localhost ([127.0.0.1]:56251 helo=lola) by fencepost.gnu.org with esmtp (Exim 4.82) (envelope-from ) id 1a0UNT-0000ol-AJ; Sun, 22 Nov 2015 08:08:23 -0500 Original-Received: by lola (Postfix, from userid 1000) id 0084EDF5F8; Sun, 22 Nov 2015 14:08:22 +0100 (CET) In-Reply-To: <87egfi5h8i.fsf@igel.home> (Andreas Schwab's message of "Sun, 22 Nov 2015 13:52:13 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::e 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:195007 Archived-At: Andreas Schwab writes: > Alan Mackenzie writes: > >> Hello, Emacs. >> >> Consider this file: >> >> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >> (defvar foo t) >> (defvar bar t) >> >> (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. > > But consistent with how setq works. How so? setq is a special form in =E2=80=98C source code=E2=80=99. (setq [SYM VAL]...) Set each SYM to the value of its VAL. The symbols SYM are variables; they are literal (not evaluated). The values VAL are expressions; they are evaluated. Thus, (setq x (1+ y)) sets =E2=80=98x=E2=80=99 to the value of =E2=80= =98(1+ y)=E2=80=99. The second VAL is not computed until after the first SYM is set, and so= on; each VAL can use the new value of variables set earlier in the =E2=80= =98setq=E2=80=99. The return value of the =E2=80=98setq=E2=80=99 form is the value of the= last VAL. [back] There is nothing in here whatsoever that would suggest an odd number of arguments is allowed or does anything useful. --=20 David Kastrup