[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

&body in non-DEFMACRO forms?



In System 78.50, ... Lisp Machine Twenty-two:

(defun f (&body x) x)
(f 'x) => x
(f 'x 'y) ;too many arguments

(defun g (&quote &rest x) x)
(g a) => a
(g a b) ;b unbound

(defun h (&quote x) x)
(h a) => a
(h a b) ;too many arguments (note how this is different kind of error than with g)

I don't understand what the &body should do here. I stumbled across this
behavior accidentally by incorrectly thinking &body meant the same as &rest
outside of DEFMACRO. It seems to do next to nothing -- I would guess it was
ignored altogether except that in the second example, it seems to have thwart
number-of-args-checking in an odd way. The compiler doesn't warn that this
is a bad construct, which is either a bug in the compiler or means I should be
pointed at documentation somewhere on what &body does... If it's a bug, I'd 
say it's prone to cause more than its share of confusion because of its 
resemblance to &rest. An intelligent error message one place or another would 
be helpful... Thanks.
-kmp