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


David Tillman <dtillman@cannonexpress.com> writes:

>    Ok, I have made module, the namespace thing works great etc.
> 
>    My question is, how do I call a function in a module if
>    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.
>    I didn't see it in the ref manual.

(define-module (there))
(define (f x) (* x x))

(define-module (here))
(define (f x) (+ x x))

(f 3) => 6

(define f-there
  (variable-ref (module-variable (resolve-module '(there)) 'f)))

(f-there 3) => 9
(f 3) => 6

this is not in any manual because the module system is slated for
redesign.  although it's been pointed out that implementation details
should not be made available, i still am wondering about the new
module system spec.  ie, will `module-variable' and `resolve-module'
still be around?

thi