Modula-3 is a programming language conceived as a successor to an upgraded version of Modula-2. While it has been influential in research circles (influencing the designs of languages such as Java and C#), it has not been adopted widely in industry. It was designed by Luca Cardelli, Jim Donahue, Mick Jordan, Bill Kalsow and Greg Nelson at the Digital Equipment Corporation (DEC) Systems Research Center (SRC) and Olivetti in the late 1980s. Its design was heavily influenced by work on the Modula-2+ language in use at SRC at the time, which was the language in which the operating system for the DEC Firefly multiprocessor VAX workstation was written. As the revised Modula-3 Report states, the language was also influenced by other languages such as Mesa, Cedar, Object Pascal, Oberon and Euclid.
Modula-3's main features are simplicity and safety while preserving the power of a systems-programming language. Modula-3 aimed to continue the Pascal tradition of type safety, while introducing new constructs for practical real-world programming. In particular Modula-3 added support for generic programming (similar to templates), multithreading, exception handling, garbage collection, object-oriented programming, partial revelation and encapsulation of unsafe code. The design goal of Modula-3 was a language that implements the most important features of modern imperative languages in quite basic forms. Thus allegedly dangerous and complicating features like multiple inheritance and operator overloading were omitted.
During the 1990s, Modula-3 gained considerable currency as a teaching language, but it was never widely adopted for industrial use. Contributing to this may have been the demise of DEC, a key Modula-3 supporter. In any case, in spite of Modula-3's simplicity and power, it appears that there was little demand for a procedural compiled language with restricted implementation of object-oriented programming. For a time, a commercial compiler called CM3 and integrated development environment called Reactor were offered by Critical Mass, Inc., but that company ceased active operations in 2000. Modula-3 is now taught in universities only in comparative programming language courses, and its textbooks are out of print. Essentially the only corporate supporter of Modula-3 is elego Software Solutions GmbH, which inherited the complete sources from Critical Mass and has since made several releases of the CM3 system in source and binary form. The Reactor IDE has been open source released after several years it had not, with the new name CM3-IDE. In March 2002 elego also took over the repository of the last other active Modula-3 distribution, PM3, till then maintained at the École Polytechnique de Montréal.
Object support is intentionally kept to its simplest terms. An object type (class) is introduced with the OBJECT declaration, which has essentially the same syntax as a RECORD declaration, although the type so declared is a reference type, whereas RECORDs in Modula-3 are not (similar to structs in C). For instance:
A = OBJECT a: INTEGER; METHODS p() := AP; END;
A, which contains a single field
a and method
p. The procedure
AP that implements
p must be defined elsewhere:
PROCEDURE AP(self: A) = BEGIN ... END;
o is a variable of type
REVEAL construct provides a conceptually simple and clean yet very powerful mechanism for hiding implementation details from clients, with arbitrarily many levels of "friendliness."
Modula-3 is one of the few programming languages that requires that external references from a
module be strictly qualified. That is, a reference in module
A to the object
x exported from module
B must take the form
B.x. It is not
possible in Modula-3 to import "all exported names" from a module. Modula-3 also requires the programmer to distinguish between declaring a method signature (
METHODS) and a method override in a subtype (
OVERRIDES). Because of the language's requirements on name qualification and method overriding, it is impossible to break a working program simply by adding
new declarations to an interface (any interface). This makes it possible for large programs to be
edited concurrently by many programmers without any worries about naming conflicts; and it also makes
it possible to edit core language libraries with the firm knowledge that no existing
programs will be "broken" in the process.
In summary, the language features:
Modula-3 is one of the rare languages whose evolution of features is documented.
In Systems Programming with Modula-3 four essential points of the language design are intensively discussed. These topics are: Structural vs. name equivalence, subtyping rules, generic modules, parameter modes like READONLY.
IO.Put ("Hello Worldn")
As in C, I/O is also provided via libraries, in Modula-3 called Rd and Wr. The object-oriented design of the Rd and Wr libraries is covered in detail in the book by Greg Nelson. An interesting aspect of Modula-3 is that it is one of few programming languages whose standard libraries have been formally verified not to contain various types of bugs, including locking bugs. This was done under the auspices of the Extended Static Checker project at DEC Systems Research Center.
Since the only aspect of C data structures that is missing from Modula-3 is the union type, all existing Modula-3 implementations are able to provide good binary compatibility with C language type declarations of arrays and structs.
Patent Issued for Using Versioned Pointers to Facilitate Reusing Memory with a Reduced Need to Reclaim Objects through Garbage Collection
Dec 06, 2012; By a News Reporter-Staff News Editor at Computer Weekly News -- A patent by the inventor Chase, David R. (Belmont, MA), filed on...