|
From: | Ian Eure |
Subject: | Re: "(setq name)": Is this a bug? |
Date: | Tue, 14 Jul 2009 09:47:20 -0700 |
On Jul 14, 2009, at 9:01 AM, Alan Mackenzie wrote:
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.Hi, Emacs,In .../lisp/files.el, function set-auto-mode, L2553, appears the strangeinvocation: (setq name) . One of my analysis tools tripped up on it. According to setq's docstring, this is invalid. In each [SYM VAL] in (setq [SYM VAL] ...), theVAL is not optional. Surely?
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
[Prev in Thread] | Current Thread | [Next in Thread] |