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

[no subject]

    Date: Sunday, 19 September 1982  00:02-EDT
    From: MOON at SCRC-TENEX

    ... What about a macro that wants to expand into both a declaration and
    some code, perhaps initializations of variables?  Or do such macros
    always take a body and expand into a LET?
I thought some about this. Basically, inits were the only things I could think
of that had any business being in the expansion with declarations. But most
things that let declarations happen are of one of two classes -- applicative
(eg, LAMBDA) or compositional (eg, LET). In the former case, inits would just 
clobber some incoming value as in 
 (LAMBDA (X) (SETQ X 3) ...)
which seems silly. In the latter case, they'd be unneeded because rather than 
 (LET (X) (INIT-FIXNUM X 3) ...)
you'd want to write 
 (LET ((X 3)) (DECLARE-FIXNUM X) ...).
I'm willing to say that macros in this position must expand into 
either declaration or code but not both. This also saves you from people who
write useful macros that are not usable in arbitrary places because they do
gratuitous declarations that force them to go at the head of a lambda contour.