On 10/14/2009 07:03 PM, Arthur A. Gleckler wrote:
>> 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.
>
> Interesting.  So, if I understand correctly, when an import form is
> executed, Declarations are created at runtime?

No - (import ...) (and the older (require ...)) are binding forms,
processed at macro-expansion-time.  If module foo exports a and b, then
   (import (rename (foo) (b b2)))
is translated to (roughly):

   (define-alias a foo:a)
   (define-alias b2 foo:b)
   (foo:run-body)

where (define-alias a foo:a) creates a binding for a (just as if define
were used), but it's indirected to the a exported by foo.

> If you wanted to,
> could the creation of the Declarations, etc. be exposed as Scheme
> primitives in a useful way?  This would allow one to write Scheme code
> that wires together existing modules dynamically, and perhaps to
> implement your module system at the Scheme level.  Does this make any
> sense?

Not that I see.
-- 
        --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