[R6RS] libraries

William D Clinger will at ccs.neu.edu
Thu Aug 17 22:27:59 EDT 2006

Matthew wrote:
> Meanwhile, it sounds like Larceny always has an indirection and closure
> anyway. Is that right? If so, do that mean there wouldn't be a
> performance hit at this level for Larceny? Put another way, would
> Larceny be 10-15% faster without the indirection?

Yes.  Yes.  Yes, on average, though it depends a lot on
the benchmark.

This is an example of our bias toward simplicity over

> That makes sense to me,
> since I think a top-level module form is a core construct, and not
> merely syntactic sugar.

I think you're in a minority there; most compilers (and
I'm not just talking about Scheme compilers) seem to use
name mangling and similar techniques to eliminate modules
and similar constructs from their intermediate languages.

> 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...

> Doesn't the phaseless model mean that an "is defined?" check will be
> needed sometimes, or is this check easy to avoid (even in less
> sophisticated compilers)?

I don't see why the check would ever be needed for a
cross-library reference.


More information about the R6RS mailing list