From: <bdo...@la...> - 2007-01-06 17:46:45
|
On Fri, Jan 05, 2007 at 12:20:42PM -0600, William Harold Newman wrote: > * Whether or not &KEY arguments allow binding the same variable > name more than once, it is probably an error to use duplicate > keywords. I think by the wording of the spec using duplicate keyword names in a lambda list (not duplicate variable names - that's just as uncertain as anything else in this discussion) is valid. For instance, (defun foo (&key ((:x x)) ((:x y))) (print (list x y))) 3.4.1.4 states: | The keyword parameter specifiers are, like all parameter specifiers, | effectively processed from left to right. For each keyword parameter | specifier, if there is an argument pair whose name matches that | specifier's name (that is, the names are eq), then the parameter | variable for that specifier is bound to the second item (the value) of | that argument pair. If more than one such argument pair matches, the | leftmost argument pair is used. I take that to mean that these results are unambiguously correct: (foo :x 4) => (4 4) (foo :x 4 :x 'no) => (4 4) Of course, it may still be less confusing to disallow duplicate keyword names, as at least one implementations fails this in compiled code (Allegro 7.0): CL-USER(5): (foo :x 4) (4 NIL) -bcd |