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 example


>   a function of the same name is in my current environment?
>   I'm sure the answer is trivial - I just don't know the syntax.
 
The simple answer is: You can't. :)

When you type
(define-module (willie) :use-modules(ice-9 test1))

a procedure in the top level environment is called:

	  (set-module-eval-closure! module
				  (lambda (symbol define?)
				    (if define?
					(module-make-local-var! module symbol)
					(module-variable module symbol))))

All you have to do is to re-define the procedure
module-make-local-var! so that the symbol is interned in the module's
obarray under a different name.

I don't think this is very difficult. About 4 or 5 hours of scheme
hacking... :)

And while you are at it, you could also make the interface a little bit
nicer. Something like 
(define willie (module (<importlist>) (<exportlist>)))
or, if you don't like total ordering ("willie.feature") you can pass
an alist of symbols so that some symbols can be imported under a different 
name.

By the way, could someone explain to me, why the guile module system
needs a hierarchical name space? I don't think this is necessary.


Jost