[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: early binding
You've pretty well answered my questions, thanks... I have one last
(small) question and comment on the following:
>Date: Wed, 16 Apr 86 20:57:31 EST
>From: Jonathan A Rees <JAR%mc.lcs.mit.edu@CSNET-RELAY.ARPA>
>
> Date: Tue 15 Apr 86 13:17:22-CST
> From: David Bartley <Bartley%ti-csl.csnet at CSNET-RELAY.ARPA>
>
> (1) What do you do if Fi is a BEGIN? For example, in
>
> (FILE F1 F2 ... (BEGIN (DEFINE A ...)(FOO)(DEFINE B ...)) ... Fn),
>
> are the DEFINEs for both A and B collected into a BIND by your pre-pass?
>
>Yes -- this is an extra bonus feature.
>
> (2) Do you expand macros during the pre-pass? What if a macro expands
> into a DEFINE or a BEGIN containing a DEFINE?
>
>Yes, macros get expanded in the pre-pass, so it "works" for a macro to
>expand into (begin (define ...) ...). Only the top level forms get
>macro expanded, not their subforms (lazy macroexpansion).
If only the top level forms get macro expanded, then a DEFINE at the
top level of a macro called FOO would not be recognized in the top
level form (BEGIN (FOO A)(FOO B)), right? That is, if (FOO A)
macro-expands into (DEFINE A 42), we'd have (BEGIN (DEFINE A
42)(DEFINE B 42)), but you'd not catch these particular ``top level''
defines?
Similarly, suppose (BAR X Y Z) were a macro that expanded into
(BEGIN X Y Z). What would happen to (BAR (FOO A)(FOO B))? Would it
be fully expanded into (BEGIN (DEFINE A 42)(DEFINE B 42)) in order
to catch the definitions?
The same question applies to macro expanding the bodies of lambdas in
order to detect ``top level'' DEFINEs to be collected into a LETREC.
To be honest, I'm not sure how deep my own PC Scheme goes in macro
expansion to detect such definitions.
Regards,
David Bartley
-------