[R6RS] modules

Michael Sperber sperber
Sun Aug 22 14:19:58 EDT 2004

>>>>> "Kent" == R Kent Dybvig <dyb at cs.indiana.edu> writes:

Kent> A tool can determine if the requires are necessary for a
Kent> particular build, but it cannot necessarily determine whether a
Kent> require can be eliminated from the source code, since a change
Kent> in an imported syntactic abstraction can affect whether other
Kent> module imports are used.  For example, does (a x) reference x?
Kent> We can answer this question for a particular definition of a but
Kent> not for all possible definitions of a.

Well, but isn't that an obscure case?  Isn't the more common case that
indeed no binding for a given import even occurs in the code?  How
does this fit in with the local-import scenario?

Maybe I misunderstood you: I thought your point was that programmers
will just delete the import along with the code that relies on them as
a matter of course---because the import is part of the code.  But you
seem to be hinting at a deeper issue.

Kent> Here's a simple one:  Suppose I want to make sure I get the r6rs cons
Kent> and not some other cons, so I write:

Kent>   ((let () (require scheme) cons) x y)

Kent> With top-level require only, I would write:

Kent>   (module ---
Kent>     (require (add-prefix scheme "real:"))
Kent>     ---
Kent>                    (real:cons x y)
Kent>     ---)

Kent> I think the former is clearer, but others may not.  (Plus, I don't have
Kent> to think of a prefix or remember what it was.)

I think the latter is clearer, in particular if "real" is renamed to
"r6rs." Moreover, will the former still work if "scheme" has been
rebound?  (And somehow, this seems like a fairly contrived example to
me :-) )

Kent> Not at all.  I'm not sure how I gave that impression, but I would
Kent> certainly want local imports to shadow local bindings.  Modules create
Kent> sets of bindings; require forms make them visible.

I guess I don't understand this paragraph at all:

Kent>   * Should bindings established by run-time require shadow bindings
Kent>     that would otherwise be visible within transformers, and visa
Kent>     versa?  For example, if M exports x, does
Kent>       (let ([x 3]) (require only-for-syntax M) x)
Kent>     evaluate to 3 or to an out-of-context error?  (I prefer error;
Kent>     I'm not sure about Matthew.)

Could you elaborate?

Cheers =8-} Mike
Friede, V?lkerverst?ndigung und ?berhaupt blabla

More information about the R6RS mailing list