[plt-scheme] Parameterized modules

From: Carl Eastlund (carl.eastlund at gmail.com)
Date: Sun May 3 12:37:54 EDT 2009

Modules cannot be parameterized, but units can.  Check them out in the
Help Desk.

On Sun, May 3, 2009 at 12:35 PM, Filipe Cabecinhas <filcab at gmail.com> wrote:
> 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


Posted on the users mailing list.