[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: setq's with missing final arguments.
From: |
David Kastrup |
Subject: |
Re: setq's with missing final arguments. |
Date: |
Sun, 22 Nov 2015 14:08:22 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Andreas Schwab <address@hidden> writes:
> Alan Mackenzie <address@hidden> 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 ‘C source code’.
(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 ‘x’ to the value of ‘(1+ y)’.
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 ‘setq’.
The return value of the ‘setq’ 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.
--
David Kastrup
- setq's with missing final arguments., Alan Mackenzie, 2015/11/22
- Re: setq's with missing final arguments., Oleh Krehel, 2015/11/22
- Re: setq's with missing final arguments., Andreas Schwab, 2015/11/22
- Re: setq's with missing final arguments., Artur Malabarba, 2015/11/22
- Re: setq's with missing final arguments.,
David Kastrup <=
- Re: setq's with missing final arguments., Andreas Schwab, 2015/11/22
- 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