[racket-dev] submodules

From: Eli Barzilay (eli at barzilay.org)
Date: Sat Mar 10 17:57:10 EST 2012

Two days ago, Matthew Flatt wrote:
> I don't think that explicit `module' or `module*' forms will be that
> common. Instead, I expect that they'll mostly be generated by
> macros, such as a `main' macro or Jay's `define-test' macro. But if
> they become common, or if we often want to re-export an external
> module via a submodule, then we should revisit this point.

Sounds to me like `module' can be common enough for segregating some
code, possibly even in a different language.  Something like a bit of
lazy/eager code inside an otherwise eager/lazy module, or some
well-isolated part of the code that uses unsafe operators, etc.  Just
like with the case for separate files.

As for which one is more "natural", I think that the main point is to
consider the dependencies: whether it more natural to expect that a
submodule depends on its surrounding module or the other way.
Currently, it's

  sub-`module*'  ⇢  module  ⇢  sub-`module'

I think that the #f-as-the-initial-require thing being allowed in
`module*' is made clear by this picture, and also the similarity
between module toplevel & sub-`module' on one hand, and repl & module
on the other.

(In case it's not clear: I'm not complaining on anything -- I'm just
providing further explanation that I think justifies the current names
for the two forms.)

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the dev mailing list.