2Modules
The need to split source files, to confine, to reuse fragments of programs to achieve the rational development for a software system arose very early in the history of programming [PAR 72]. This has been studied in Chapter 1 where kits are presented as a model that is a general answer to this need. To implement this model, some programming languages provide a dedicated construct often referred to by the generic name module. We examine them in this chapter.
Modules appeared in the early 1980s, under the name structure in STANDARD ML [MIL 19], module in OCaml [INR 19], package in Ada [AUT 19] or cluster [LIS 81] for instance.
At the same time as module creation, the theory of algebraic abstract data types (ADT) [GOG 78] was under development. It formally models the notion of a data set associated with operations as a term algebra whose properties are stated by equations between terms. This allows one to formally reason about these sets independently from their implementation. Any model consistent with these equations defines a semantics of the ADT. ADTs have been a great source of inspiration for designing the modules of the current languages.
Modules of programming languages are implementations of kits. They all allow us to manipulate a collection of type definitions and values but also, depending on the language, of constants, variables, functions, procedures, classes, exceptions or modules. Thus, we find in this list all the ingredients of a kit. Whatever the language, ...
Get Concepts and Semantics of Programming Languages 2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.