Reputation: 1579
Assume I have the following two modules:
(module mod1 (func2)
(define (func1) ...)
(define (func2) ... (func1) ...))
(module mod2 ()
(import (only mod1 func2))
(define (func1) ...)
(define (func3) ... (func2) ...))
Does the call to func2
in func3
use mod2
's version of func1
or mod1
's version?
Upvotes: 0
Views: 65
Reputation: 2292
The best way to do this is to pass func1
to func2
somehow. Either as an argument, or through a SRFI-39 parameter that mod1
exports:
(module mod1 (func2)
(define (func1) ...)
(define the-func (make-parameter func1)) ; defaults to our version
(define (func2) ... (let ((func1 (the-func)) (func1)) ...))
(module mod2 ()
(import (only mod1 func2))
(define (func1) ...)
(define (func3) ... (parameterize ((the-func func1)) (func2)) ...))
Upvotes: 1