[r6rs-discuss] [Formal] Replacing the import's "for" syntax with implicit phasing

From: Abdulaziz Ghuloum <aghuloum>
Date: Fri Nov 17 14:52:34 2006

On Nov 17, 2006, at 12:18 PM, Sam TH wrote:

> On Fri, 2006-11-17 at 10:01 -0500, Abdulaziz Ghuloum wrote:
>> On Nov 17, 2006, at 8:42 AM, Sam Tobin-Hochstadt wrote:
>>
>>> This is incorrect. Visiting F is necessary to determine what
>>> bindings
>>> F
>>> provides. For example, if F is:
>>
>> No. F is already expanded and compiled. I don't care about its
>> source.
>
> This is not what you said. To quote you slightly more extensively:
>
>> Suppose the library F is defined as follows:
>>
>> (library F
>> (export f)
>> (import r6rs)
>> (define f 12))
>>
>> Also, suppose G imports F because it needs it:
>>
>> (library G
>> (export g)
>> (import r6rs (for F expand))
>> (let-syntax ([m (lambda (_) f)])
>> (define g (m)))
>> --other-stuff--)
>>
>> Expanding G causes
>> F to be visited (not needed: doesn't use any of F's macros)
>> F to be invoked (needed to evaluate F's f)
>>
>> Visiting G causes
>> F to be visited (not needed: doesn't use any of F's macros)
>> F to be invoked (not needed: doesn't use any of F's variables)
>
> Here you claim that neither expanding nor visiting G requires F to be
> visited (that's what "not needed" means).

That is what I said, yes. Maybe the terminology got mixed up but I
consider visiting to be evaluating the right-hand-sides of transformers
and binding them to the keywords (plus invoking any other libraries as
required). Since G does not use any of F's macros, none of F's macros
(if they exist) need to be evaluated.

> This claim is false, as I
> demonstrated - both expanding and visiting G require knowing the
> bindings provided by F, which requires expansion of F.

Expanding F is a separate stage from Visiting F for compiling another
library which is in turn a different stage from invoking F for running
another library. The fact that I assumed F is expanded and compiled is
irrelevant as I was talking about visits (i.e. evaluating the
transformers rhss) and invokes (i.e. evaluating the variables rhss and
the init expressions).

> Had F previously
> been compiled (which you did not state), then that would not be
> necessary.

The visits and invokes as I stated them in the examples are required by
the current draft. That is my understanding of what Section "6.2.
Import and export phases" requires and this is what the reference
implementations do (Andre, please correct me if I'm making assumptions
about your implementation).

> However, in your example, nothing has been compiled before
> the expansion of G, so F must be expanded.

I don't understand what you mean. If H imports G which imports F, then
F must be compiled (meaning expanded, processed, whatever) before G and
G must be compiled before H. Visiting and invoking a library are
different from compiling it (or expanding it).

Aziz,,,
Received on Fri Nov 17 2006 - 14:52:27 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:00 UTC