[R6RS] libraries

Matthew Flatt mflatt at cs.utah.edu
Thu Aug 17 23:36:16 EDT 2006


At Thu, 17 Aug 2006 22:27:59 -0400, William D Clinger wrote:
> > Finally, a question about the performance cost of not having phases. As
> > we've distilled it down, my interest in phasing is that if code refers
> > to an imported binding X, then X will definitely be bound at run time.
> > Consequently, you don't need an "is X defined?" check at run time when
> > referring to an imported X.
> 
> I don't follow this, for two separate reasons.  One is 
> that, as libraries are currently specified (with mono-
> or multi-phase semantics),  the defined? check is needed
> anyway (for intralibrary references) to detect violations
> of the letrec restriction.  The other is that invoking a
> library at phase n does not execute any of its code until
> all of its imported libraries are invoked at phase n;
> that means all of the imported variables will be defined
> before any of the importing library's references to them
> can be executed.  And so...

Where I wrote "imported binding" I should have written "binding from a
different library".

When you don't distinguish phases, you can end up referencing at phase
n a binding from library X, where X is not in the transitive closure of
the phase-n imports.

So, yes, an "imported" binding will be ready, as long as "imported"
means that the binding was brought into scope with `import'. But a
binding "from a different library" may not be ready at the relevant
phase.

Matthew




More information about the R6RS mailing list