[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.
John?
--
Alan Mackenzie (Nuremberg, Germany).
- Re: setq's with missing final arguments., (continued)
- Re: setq's with missing final arguments., David Kastrup, 2015/11/22
- Re: setq's with missing final arguments., Andreas Schwab, 2015/11/22
- Re: setq's with missing final arguments., Alan Mackenzie, 2015/11/22
- Re: setq's with missing final arguments., Eli Zaretskii, 2015/11/22
- Re: setq's with missing final arguments., Alan Mackenzie, 2015/11/22
- RE: setq's with missing final arguments., Drew Adams, 2015/11/22
Re: setq's with missing final arguments., David Kastrup, 2015/11/22
Re: setq's with missing final arguments., Johan Bockgård, 2015/11/22
RE: setq's with missing final arguments., Drew Adams, 2015/11/22
- Re: setq's with missing final arguments.,
Alan Mackenzie <=