[plt-scheme] Organizing Code

From: Danny Yoo (dyoo at hkn.eecs.berkeley.edu)
Date: Tue Mar 7 20:13:19 EST 2006

> Is there anything similar to this in Scheme, specifically PLT Scheme?
> Modules do not seem to fit the bill as they cannot span multiple files
> and the current version of package.ss is broken.

Hi Kevin,

Modules can be split up into several submodules.  Here's an quick toy

> (module a mzscheme
    (provide a)
    (define (a) (printf "Hi, I'm a~n")))
> (module b mzscheme
    (provide b)
    (define (b) (printf "Hi, I'm b~n")))
> (module c mzscheme
    (require a)
    (require b)
    (provide (all-from a))
    (provide (all-from b)))
> (require (prefix c: c))
> (c:a)
Hi, I'm a
> (c:b)
Hi, I'm b

Does this do what you want?

For more realistic examples, we can take a look at our PLT installation's
'collects' directory and look for anything with a 'private/' subdirectory.
A collection will frequently hide implementation-specific modules within
their own 'private/' subdirectory.

Best of wishes!

Posted on the users mailing list.