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

Macros -> declarations

Suppose: We flush Macros -> declarations.

Question: Is the compiler allowed to do arbitrary and repetitive
("destructive") macro expansion at any time?  By "destructive", I don't
necessarily mean RPLACA, I mean that the compiler then operates on the
expanded expressions?

If the answer is 'No' I suggest CLtL explains WHEN the compiler IS
allowed to expand macros.

If the answer is 'Yes' then I don't see how it is possible to flush
macro calls expanding into declarations.  In this case, the
implementation of the compiler, NOT THE DEFINITION OF LANGUAGE, will
determine the semantics of the macro.  A compiler that pre-expanded all
forms and subforms before "compiling" it would get the declarations that
were the result of macro expansion.  (As a side effect, the compiler
would be guarenteed it wouldn't have to do macro expansion during
"compiling".)  A compiler that expanded outermost expressions as it got
to them would not see the declarations which came from macros.

An alternative, which I mention just for completeness and is so vile I'm
glad I'm not prone to vomiting, is to kludge the automatic macro
expansion facility to know when declarations are possible and not to
expand macros it sees in those places (or maybe expand the macros but
wrap a PROGN around it).