[R6RS] modules?

Matthew Flatt mflatt
Thu May 27 16:27:24 EDT 2004

At Thu, 27 May 2004 21:46:22 +0200, Michael Sperber wrote:
> >>>>> "Matthew" == Matthew Flatt <mflatt at cs.utah.edu> writes:
> Matthew> At Thu, 27 May 2004 21:02:47 +0200, Michael Sperber wrote:
> Matthew>   (module foo (lib "unit.ss")
> Matthew>     (import "baz-sig.ss")
> Matthew>     (export "foo-sig.ss")
> >> 
> >> But this means that you have to write the MODULE form in this way to
> >> start with, no?  Or do you see a way to use the *existing* MODULE
> >> form in this manner?

[Ah - I thought you meant the `module' syntactic form, as opposed to
this particular use of `module'.]

> (require "baz.ss")
> where baz.ss contains some module definition
> rather than
> (import "baz-sig.ss")
> where "baz-sig.ss" presumably contains a signature definition.  Once
> you've written the former, you can't convert it into the latter
> without changing the source.  (Which may not be possible.)

Agreed. If you write a module body in some language like `mzscheme',
then it can't be used as a unit. And if you write a module body in a
`unit' language, then the body can't be treated directly as top-level
module declaration.

I suppose it would be easy to have a "unit-too.ss" language that
effectively copies a module body, with one copy at the module top-level
and another copy in an exported unit. (The code couldn't actually have
to be duplicated, of course. The module-level bindings might be
obtained by invoking the unit.) Is that the sort of thing that you have
in mind?


More information about the R6RS mailing list