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

(defmacro foo (&whole w) ...)



    Date: Sun, 26 Aug 84 21:11 EDT
    From: "Daniel L. Weinreb" <DLW@SCRC-QUABBIN.ARPA>

    T. Yuasa and M. Hagiya of Kyoto University independently implemented
    Common Lisp for the Data General MV/10000.  They had a number of
    questions about the definition of Common Lisp, which they accumulated in
    a file....

    In a defmacro argument list, (&whole w a b) presumably means that there
    must be exactly two arguments to the macro, which a and b will be bound
    to, and furthermore that w will be bound to the whole thing.  By
    extension, (&whole w a) means that there must be exactly one argument,
    and so (&whole w) means that there must not be any arguments at all.  If
    so, then the (&whole w) case is evidently useless, and if what you
    really want is to just have a macro that lets you examine the body
    yourself and doesn't play with argument lists, you need to do (&whole w
    &rest ignore) or something.  Is this really the definition of Common
    Lisp?

Due to a bug in our implementation, neither (defmacro foo (&whole w) ...)
nor (defmacro foo () ...) checked the number of subforms, although all other
cases of defmacro did.  I decided that this was actually a feature in the
&whole case, so when I fixed the bug I made the &whole case be treated
specially and not check the number of subforms.  This is certainly a
wart, but it makes life easier for the user and I can't see how it hurts
anything.  In particular, I have some places where I want to depend on
this myself.  [By the way, the bug is only fixed in my private copy of
defmacro currently.]

I propose these rules for inclusion in the language:

 (defmacro foo () ...) requires that invocations of foo have no subforms.

 (defmacro foo (&whole w) ...), as a special case, allows any number of subforms.

 (defmacro foo (&whole w a) ...) requires that invocations of foo have exactly one subform.

Opinions?