[plt-scheme] Parameterized modules
Hi,
How can I parameterize a module?
For example, I have module A, which depends on a module that implements
B. When I (require A), I want to be able to tell it which of the B
implementations I want to use. This is useful when you have several
backends and a frontend. I have a frontend that is available as
macros/functions to a scheme program. When I (require A), I want to be
able to tell it to use B1 or B2, for example:
a.scm:
#lang scheme
(define a ()
(+ (b) 42))
b1.scm:
#lang scheme
(define b ()
1)
b2.scm:
#lang scheme
(define b ()
2)
Then I want to use it:
client.scm:
#lang scheme
(require-parameterized a b1) ;; or b2
...
Can I do something like this? What if B also uses A's functions?
Regards,
Filipe