[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Modules and Extensions
At 8:31 PM -0600 7/17/01, Matthew Flatt wrote:
>In general, they are to be used together. Modules can replace units
>where units are used merely for namespace control, but `unit' still has
>its own place:
>
> * Implementing parameterized components: The `unit' form separates
> interface from implementation, unlike `module'. For example, the web
> browser is still a unit, so that its base GUI classes and ".plt"
> handler can be parameterized.
>
> * Encasulating a program that has "global" state: A unitized program
> can be instantiated multiple times. For example, the compiler part
> of mzc is still a unit so that it can be run easily by other tools.
DrScheme still uses units for two other reasons:
* Mutually recursive linking: modules don't allow this.
* Dynamic linking: the tool-set is not determined at compile
time, so DrScheme dynamically loads and links tools.
Modules handle some of this with `dynamic-require',
but I wanted to provide imports to the dynamically
linked component and those imports come from units
(which you use, because they were linked recursively).
I found the easiest thing was to use units.
DrScheme also uses multiply-invoked units. I'm not sure how mzc is
ever invoked multiple times in one mzscheme or mred, but teachpacks
certainly are (I'm still working on that, actually -- teachpacks may
change...).
Robby