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: module interface changed or changing?




> It's not there becuase the module system is going to be changed RSN


What about: 

(define m (module ((<import-Module> (<import-features>))) 
		  (<export-features>)))

where <import-features> may be 

1.) empty   -> all features from module "M" are imported and are renamed to
               something like <M>.<feature name> or <M>-<feature name>

2.) a list of symbols  -> only the listed features are included.

3.) a list of pairs    -> only the listed features are included, but renamed
                          to the CDR of the pair.                


So for example:

(define expect (module 
		((regex () ))
		(port timeout timeout-proc eof-proc char-proc)))

(define port #f)      ; define features (no "define-public" neccesary)
(define timeout #f)
...
<EOF>

defines the interface of the module "expect".


You can use and redefine some features of expect as follows

(define my-expect (module
		   ((expect (port . base) timeout))
		   (features i want to export)))
; do something usefull with "port", now named "base" and "timeout"
...
<EOF>


Or you can simply import all features

(define mymod (module
		   ((expect () ) ; import all features and rename them to 
                                 ; mymod.port, mymod.timeout etc.

; do something usefull with "mymod.port", "mymod.timeout" etc.

...
<EOF>


Jost