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]

A new module system for Guile




Okay, here is something to play with, a proposal for a new module system.
I've uploaded a set of patches against the current cvs source on 
/ftp@ftp.tfh-berlin.de:/pub/incoming/module.tar.
(The directory at red-bean /ftp@ftp.red-bean.com:/pub/incoming/ is
not public writeable)

It is a full featured module system that uses separate name spaces
(every module has its own obarray), total ordering based on 
the unix file system abstraction (module "peter/test" is differend from 
"hugo/test"), and is very small and simple.


Some examples:

; create a new module "hugo"
(module "hugo")

(define a 1)
(define* p 2) ; same as "define-public"

;--------------------
;create a new module "walter"
(module "walter")

(define a 2)
(define* p 3);

;--------------------
;back to module "hugo"
(module "hugo")
a -> 1
(define* k 12)

;--------------------
;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)

;--------------------
;back to "hugo"
(module "hugo")
p -> 99

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

p.p -> 9
h.p -> 99
w.p -> 3


The module system is not complete yet, so don't expect too much. :)


Jost