Claus Reinke wrote:
> `First class modules' are just that: modules that are also first
> class data objects of the programming language (e.g., records
> containing functions).
I would alter that to "(e.g., records containing functions _and
types_)", at least for statically typed programming languages. I don't
think you can justify calling something that cannot contain types, a
module, in such languages.
> In a functional language, it is standard to
> have first class programs, so why shouldn't program building blocks
> have the same status? [...]
>
> It would really be nice to have first class modules, even in a less
> idealized form, in modern functional languages, including Haskell -
> there seem to be no counter arguments of the style "don't want that",
> but quite a few of the kind "can't do that", especially if a static
> type inference system is involved or if you insist on having type
> declarations inside modules instead of typing the module itself.
The key words here are "type _inference_ system is involved"; my
work with Robert Harper (Bibtex cite below) shows how to build true
first-class modules in an explicitly-typed functional programming
language that is a superset of SML. The resulting system is fully
functional, allowing such things as abstracting over modules.
How to build first-class modules into an ML-style
implicitly-typed language is unclear currently; for example, my version
of first-class modules automatically gives you at least F_2, which does
not fit in the ML type system, because you can abstract over modules
containing a single type.
> PS. Please send me any references on first class modules that I
> haven't found yet. Thanks.
I'll have to check to see how up to date your list is when I get
access to a decent WWW browser again. (I'm home sick at the moment.)
- Mark Lillibridge
@InProceedings{harper+:sharing,
author = "Robert Harper and Mark Lillibridge",
title = "A Type-Theoretic Approach to Higher-Order Modules with
Sharing",
pages = "123--137",
booktitle = "Twenty-first {ACM} Symposium on Principles of
Programming Languages",
year = 1994,
address = "Portland, OR",
month = "January"
}