[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Binding the same variable twice in a single form
Date: 12 Apr 90 20:43:29 GMT
From: lgm@ihlpf.att.com
(MULTIPLE-VALUE-BIND (IGNORE IGNORE X) (FUNC)
<use X somehow>)
The question is whether this usage is portable. Other Common Lisp
implementations may treat IGNORE as an ordinary variable name, and
thereby interpret the expression as binding the same variable
twice in the same form.
I've run into this as well, and have resorted to:
(multiple-value-bind (ignore1 ignore2 x) (func)
(declare (ignore ignore1 ignore2))
<use X somehow>)
althought I typically give the ignored arguments meaningful names
relative to the returned values for documentation purposes.
The Symbolics allows this silently in any
case, even an obvious one like
(LET ((A 3) (A 4)) A)
But do other CL implementations act similarly?
I tried compiling this function:
(defun test ()
(let ((a 1)(a 2) a)
a))
Symbolics responds like this:
The variable A was never used.
The variable A was never used.
Franz's Allegro:
Warning: variable A is never used
Warning: variable A is never used
Sun/Lucid:
>>Error: (A A A) is an ill-formed lambda-list --
the variable A occurs more than once in it
Explorer:
The variable A appears twice in one binding list.
The variable A appears twice in one binding list.
The variable A is bound but never used.
The variable A is bound but never used.
I couldn't find any reference to the use of IGNORE as an ignored
variable in CLtL2 or in (an admittedly old version of) the X3J13
document.
Steve
--
Stephen L. Nicoud <snicoud@atc.boeing.com> uw-beaver!bcsaic!snicoud
Boeing Advanced Technology Center for Computer Sciences