* "(setq name)": Is this a bug?
@ 2009-07-14 16:01 Alan Mackenzie
2009-07-14 16:47 ` Ian Eure
2009-07-14 18:49 ` Stefan Monnier
0 siblings, 2 replies; 3+ messages in thread
From: Alan Mackenzie @ 2009-07-14 16:01 UTC (permalink / raw)
To: emacs-devel
Hi, Emacs,
In .../lisp/files.el, function set-auto-mode, L2553, appears the strange
invocation:
(setq name)
. One of my analysis tools tripped up on it. According to setq's doc
string, this is invalid. In each [SYM VAL] in (setq [SYM VAL] ...), the
VAL is not optional. Surely?
I think this is a bug.
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: "(setq name)": Is this a bug?
2009-07-14 16:01 "(setq name)": Is this a bug? Alan Mackenzie
@ 2009-07-14 16:47 ` Ian Eure
2009-07-14 18:49 ` Stefan Monnier
1 sibling, 0 replies; 3+ messages in thread
From: Ian Eure @ 2009-07-14 16:47 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: emacs-devel
On Jul 14, 2009, at 9:01 AM, Alan Mackenzie wrote:
> Hi, Emacs,
>
> In .../lisp/files.el, function set-auto-mode, L2553, appears the
> strange
> invocation:
>
> (setq name)
>
> . One of my analysis tools tripped up on it. According to setq's doc
> string, this is invalid. In each [SYM VAL] in (setq [SYM VAL] ...),
> the
> VAL is not optional. Surely?
>
I suspect the documentation just isn't clear. From a brief reading of
the source, setq supports 0/1/odd arguments, with `nil' being used in
the case of non-mod-two argument arity.
In a nutshell, it loops over the arguments two at a time until they're
empty, setting the car of the args_left to the evaluated cadr of
args_left. If you're at the end of a list, the cdr is `nil', and the
car of `nil' is also `nil'.
So if you give it an odd number of arguments, the last value will be
nil.
- Ian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: "(setq name)": Is this a bug?
2009-07-14 16:01 "(setq name)": Is this a bug? Alan Mackenzie
2009-07-14 16:47 ` Ian Eure
@ 2009-07-14 18:49 ` Stefan Monnier
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2009-07-14 18:49 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: emacs-devel
> Hi, Emacs,
> In .../lisp/files.el, function set-auto-mode, L2553, appears the strange
> invocation:
> (setq name)
> . One of my analysis tools tripped up on it. According to setq's doc
> string, this is invalid. In each [SYM VAL] in (setq [SYM VAL] ...), the
> VAL is not optional. Surely?
> I think this is a bug.
It's accepted bny the interpreter and the compiler, AFAIK, but I do
consider it as a bug, so please fix it to (setq name nil).
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-07-14 18:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-14 16:01 "(setq name)": Is this a bug? Alan Mackenzie
2009-07-14 16:47 ` Ian Eure
2009-07-14 18:49 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.