first-class modules

Jon Fairbairn
Tue, 26 Mar 2002 18:07:36 +0000

David Feuer wrote:
> A number of people have discussed the use of implicit parameters to
> mimic global variables in Haskell.  I am wondering if any have done the=

> same for a first-class module system such as that proposed by Shields
> and Jones.  It seems to make a tremendous amount of sense to do it that=

> way:
> =

> 1.  semi-constant values:  Things that are calculated

aren't a problem unless they depend on something that's
input at run-time.

> or input at the beginning of the program could be handled
> by Main.main, which would pass the results to the Second
> module, whose main function it could then call.  This
> seems much more natural than the implicit parameter
> approach for this purpose.

This approach could also solve the "here document" question.
If we allow modules that define a value rather than names
and are in a range of different syntaxes, we can import the
value at the point of use. Having foreign values in files
would allow things such as the import of a font metric file
as a constant, which would be much nicer than reading it
from a file and having to pass it around.