This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: New environment/module patches


thi <ttn@mingle.glug.org> writes:

>  > 	       (export a b c internal)
>  >           (public a b c))
>  > 
> this is confusing to me; i tend to think of "export" and "public"
> synonymously. 

My english is quite bad, but what about `(protect internal)' and `(public a b c)'?


> why not use "evalable" or something like that instead of

I would call the eval-environment bindings "evalable".  Those in the
protect-environment are protected by the package boundary and those in the
expor-environment are visible to the world.


> i'm curious as to how the following sequence would work:
> 
> (define-module (my test))
> (define a 12)
> (define-module (user))
> (define (answer) (module-ref (resolve-module '(my test)) 'a)) ; or equivalent
> (module-close (my test))
> (define-module (user))	; perhaps not required
> (answer)

user/guile> (define-module (my test))
my/test> (define a 12)
my/test> (define-module (user))
user/user> (define (answer) (module-ref (module-access (my test)) a))
user/user> (module-close (my test))
user/user> (answer)
ERROR: module could not be loaded my/test
ABORT: (misc-error)
user/user> 

`define-module' is currently rewritten into something like:

(define define-module 
  (procedure->memoizing-macro 
   (lambda (x env) 
     `(module-go (module-create ,(cadr x)

(of course, the "real" definition is more complex).  The problem with
module-create is that it doesn`t really create a module, it only 
creates a collection of environments and a module signature, but not
a permanent module. 


> from your example, it looks like `define-module' examines the
> closed-module mark.  who else does this?

The compiler.

The compiler must not compile an opened module while a closed module
doesn't have a repl.


Jost

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]