[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(defmacro foo (&whole w) ...)
Well, I guess what it boils down to for me is that in 95% of the cases
where there is an &WHOLE in a macro, that's all there is, and it's a
pain to have to write an explicit &REST argument when you could just
take the cdr of the &WHOLE arg. By the way, your "&REST IGNORE" must be
accompanied by (declare (ignore ignore)) in order to work in Common
Lisp. The special-case treatment of variables named IGNORE got flushed
in favor of the more uniform IGNORE declaration, I believe. The
question is whether it is more trouble and more confusing to have to add
that &REST arg and the IGNORE declaration in a lot of places, or to put
in an explicit length check on the &WHOLE are in the rare case that you
want the arglist to have some maximum length.
Actually, I have seen &WHOLE used in only two ways: first, when you're
in a macro with some sort of complex syntax and don't want the usual
argument destructuring (in which case, it is best to disable the
too-many-args check); second, in cases where you do want normal
destructuring, but need to get at the CAR of the calling form. I'd like
to see an additional form for that specialized purpose: something like
&first (though I'd like to find a better name for it). That would
clarify the programmer's intention and would not disable arg-count
checking.
Of course, if I am wrong about this and people are writing lots of code
that mixes &whole (for some use other than getting at the car of the form)
and hairy arglist destructuring, then &whole should be orthogonal after
all. We may have a cultural difference here.
-- Scott