Main Page | See live article | Alphabetical index

Modula-2

Modula-2 is a computer programming language invented by Niklaus Wirth at ETH about 1978. The name is a derivative of that of an earlier programming language, simply called Modula, which was developed as a systems implementation language, akin to BLISS or C. Modula-2 is a general purpose procedural language, sufficiently flexible to do systems work, but with much broader application. In particular, it was designed to support separate compilation, and the very important concept of data abstraction, in a straightforward way. Much of the syntax is based on Wirth's earlier language, Pascal. Modula-2 was designed to be broadly similar to Pascal, with some elements removed and the important addition of the module concept, and direct language support for multiprogramming.

The central concept of Modula-2 is the module, which may be used to encapsulate a set of related subprograms and data structures, and restrict their visibility from other portions of the program. The module design implemented the data abstraction feature of Modula-2 in a very clean way. Modula-2 programs are composed of modules, each of which is made up of two parts: a definition module, the interface portion, which contains only those parts of the subsystem that are visible to other modules, and an implementation module, which contains the working code that is internal to the module.

The language provides for (limited) single-processor concurrency (monitors, coroutines and explicit transfer of control) and for hardware access (absolute addresses, bit manipulation, and interrupts). It uses name equivalence.

Although Modula-2 is by far the best-known and most widely used variant, there are several languages which are related in one way or another: the original, and quite different, Modula (intended for systems implemenation), Modula-2+, Modula-2*, Modula-3 (by DEC and Olivetti and intended to add such things as garbage collection to the base language), Oberon (another, later, Wirth design), Oberon-2, and a number of others. These should not be regarded as "better versions" or "replacements" for Modula-2; most are different languages with different purposes, and with strengths and weaknesses of their own. Along with C and Ada, Modula-2 is often regarded as one of the three most significant "modern" programming languages (ie, of the structured programming era). Of the three, Modula-2 is the smallest, easiest to read, easiest to learn, and cleanest design, both syntactically and conceptually.

Modula-2 was developed as the system language for the Lilith workstation, and formed the basis of the Oberon project at ETHZ. Most current programming languages have adopted many of the features of Modula-2.

External Links

Credit

This article is based on material from
FOLDOC, used with permission. Update as needed.