[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setq's with missing final arguments.

From: Alan Mackenzie
Subject: Re: setq's with missing final arguments.
Date: Sun, 22 Nov 2015 23:08:15 +0000
User-agent: Mutt/1.5.23 (2014-03-12)

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.


Alan Mackenzie (Nuremberg, Germany).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]