On 10/14/2009 10:53 AM, Arthur A. Gleckler wrote:
> I will go read some code, but I would love to hear from implementers
> about how their implementations' module systems work under the covers.

In Kawa, each lexical variable (or macro) definition is represented
by a Declaration.  Each scope provides a set of Declarations;
for a module, some Declarations are marked as exported.

When a module is imported, the compiler creates "alias declarations"
which are synonyms of the the Declarations exported by the module.
Alias declarations may have a different name than the "aliasee",
which supports renaming.  These alias declarations are added to the
scope of the importing module, so they're found during lexical name
lookup.  In principle one can have an import nested inside an
inner lambda or let, though I haven't tested that.

Compiling a module creates a "module class file" (and possibly other
class files).  Importing a previously-compiled module works by
re-creating (using reflection) the set of Declarations exported by
the module, and as above adding a set of alias declarations to the
importing scope.

There are some interesting issues whether there can be multiple
"instances" of a module - i.e. multiple run-time variables
corresponding to the same static declaration.  My thinking
is there would be only one module instance per "Scheme context",
but that might not be the right approach.
-- 
        --Per Bothner
[email protected]   http://per.bothner.com/

_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to