[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Some easy ones (?)
Date: 24 Jul 1986 15:29-EDT
From: NGALL@G.BBN.COM
Yes. PARSE-BODY called with DECLARATIONS-ALLOWED-P of NIL would be
used to verify that an implicit PROGN does not begin with decls (it
could be used with 'bodies' other than implicit PROGNs, but only if
such bodies do not allow a declaration-like syntax (unlike CASE and
COND (boy, did I pick a bad example!)).
Yes. Its contract would be to make sure there aren't any declarations.
This was the point I was trying (and failing so miserably) to make.
PARSE-BODY currently has no contract to make sure declarations are only at
the beginning. To do so it might have to expand macros (needlessly).
Therefore it isn't suitable for your intent of using it to verify
implicit PROGNs. Consider
(when (predicate)
(print 'foo)
(declare (inline xyzzy))
(print 'bar))
which is illegal. PARSE-BODY is for parsing bodies. Period. Implicit
PROGNs are not bodies. Really. PARSE-BODY's contract should be simple:
extract the three components of a body: the declarations, the
documentation, and the implicit PROGN. That is what a body is.
Something that isn't that isn't a body.