[R6RS] Re: modules

Richard Kelsey kelsey
Mon Aug 30 21:56:57 EDT 2004

   Date: Mon, 30 Aug 2004 14:52:51 -0500 (EST)
   From: "R. Kent Dybvig" <dyb at cs.indiana.edu>

   I don't think I follow what you're saying, but let me try to be clear
   what I expect, which is that (eval `(lambda () (foo ,v))) take the same
   amount of time no matter what v is, if (foo x) expands into (quote x).
   I don't want the expander to have to touch v at all.  This is currently
   the case with Chez Scheme and with the portable syntax-case expander.
   If the expander scans through v looking for potential implicit exports
   because it can't be sure that (foo x) expands to (quote x), this won't
   be the case.

If EVAL is permitted to evaluate code in a module you aren't
going to get very far with static analysis in that module,
whether or not "implicit" exports are declared by the user.
All top-level bindings would be available to EVAL, which may
SET! them.  If EVAL can't evaluate code in a module then it
cannot introduce new implicit exports and forms passed to
EVAL need not be scanned.

As Will said, scanning for implicit exports is entirely optional.
It is correct, if conservative, to assume that all top-level
identifiers are exported.

If you want more accuracy, either the user will have to declare
export that would otherwise be implicit, or the compiler will
have to perform some sort of static analysis to find them.
Unless I have missed something, the implicit exports we have
been discussing are those from top-level macro definitions.
Only top-level bindings are exported and only macro definitions
introduce implicit exports.  Determining that `(lambda () (foo ,v))
is not a top-level macro definition does not require looking any
further than the initial 'lambda', even if EVAL is permitted to
evaluate code inside an existing module.

More information about the R6RS mailing list