This is the mail archive of the guile@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: A new module system for Guile


Jost Boekemeier <jostobfe@calvados.zrz.TU-Berlin.DE> writes:

> ; create a new module "hugo"
> (module "hugo")
> 
> (define a 1)
> (define* p 2) ; same as "define-public"

What if this was:

(module "hugo"
  (define a 1)
  (define* b 2))

That could also return a reference to the module, like your module*.

Have you considered using symbols instead of strings?

Can modules be nested?

> ;create a new module "test"
> (module "test")
> (define h (module* "hugo")) ; use-module: hugo
> (define w (module* "walter")) ;use-module: walter
> 
> h.p -> 2
> w.p ->3
> (set! h.p 99)

What if...

(define (foo mod)
  mod.p)

(foo (module* "hugo"))
(foo (module* "walter"))
(foo 0)  ; this is an error, but where?

> (module "test")
> (define p (module* "ice-9/test1")) ; ice-9 not defined yet, load it 

Oh, here's the difference between module and module*.

-- 
Kalle Olavi Niemitalo <tosi@stekt.oulu.fi>, http://stekt.oulu.fi/~tosi/