Previous Table of Contents Next


Part VI
Modula-3

11  The Modula-3 Programming Language

CHAPTER 11
The Modula-3 Programming Language1


1The Modula-3 language specification was designed and written by Luca Cardelli, Jim Donahue, Mick Jordan, Bill Kalsow, and Greg Nelson. Farshad Nayeri edited the language reference for inclusion in this book.
Module-3 language definition is copyright© 1989-1991. Digital Equipment Corporation. All rights reserved.
Distributed by permission of the Systems Research Center of Digital Equipment Corporation in Palo Alto, California.
This work may not be copied or reproduced in whole or in part except in accordance with this provision. Permission to copy in whole or in part without payment of fee is granted only to licensees under (and is subject to the terms and conditions of) the Digital License Agreement for SRC Modula-3 as described in http://www.research.digital.com/SRC/m3sources/html/COPYRIGHT.html.
All such whole or partial copies must include the following: a notice that such copying is by permission of the Systems Research Center of Digital Equipment Corporation in Palo Alto, California; an acknowledgment of the authors and individual contributors to the work; and this copyright notice. All rights reserved.

by Farshad Nayeri

The language designer should be familiar with many alternative features designed by others and should have excellent judgment in choosing the best and rejecting any that are mutually inconsistent.…One thing he should not do is to include untried ideas of his own. His task is consolidation, not innovation.

C. A. R. Hoare

11.1. Preface

If you were to choose one programming language for developing and maintaining all your programs, what would it be? Modula-3 is designed to be the answer to this question, as it is a practical programming language for systems development at-large. Based on programming language demographics at the time of press, however, you are likely to have chosen C, C++, Java, Smalltalk, or Ada95. Therefore, some justification is required.

First and foremost, Modula-3 designers emphasized safety unlike the approach taken by the designers of the C programming language. Designed in the late 1980s, Modula-3 is a pioneer in the adoption of the trio of modern systems programming features—garbage collection, exceptions, and threads—which were later popularized by Java. The language design does not stop there; it provides interfaces and modules, a squeaky-clean type-system, and a simple but scalable object system. The well-integrated set of features has resulted in a language that makes code maintenance much more straightforward.

In contrast to the approaches taken by C++ and Ada designers, however, Modula-3 designers refused to give up on simplicity in order to achieve. To combat “featuritis,” the designers limited the language definition to 50 pages. (Indeed, the language definition for Modula-3 is the only one that fits into a chapter of this handbook.) This language definition economy has paid off in the long run: It is much easier to build tools for Modula-3, and to maintain the compiler and the runtime. It also made it easier for early developers to build a complete reference implementation of the compiler and the runtime that has stood the test of time.

Last but not least, Modula-3 does not forgo practical systems programming features in order to achieve its foremost goals. This is a an essential differentiating feature of Modula-3 when compared with Smalltalk or Java. Like traditional systems programming language, Modula-3 permits bit arithmetic, untraced pointer references, and unsafe casts. However, to eliminate contamination of safe code, the language only allows unsafe operations in clearly marked unsafe modules. In addition, the language design provides a bridge for smooth integration of safe and unsafe code under the same language.

Despite syntactic differences, many of the Modula-3 design ideals were embodied in Java’s design, about five years later. Modula-3 has done well on its own, too, especially given the relatively small amount of resources spent on its promotion. Modula-3 has so far met the challenges for developing and maintaining large, high-performance systems quite well, for example, in building life-critical 911 emergency call systems, highly available network object systems, Internet commerce and distribution management systems, high-performance graphics systems, extensible operating systems, and even a commercial-grade Java virtual machine.2


2You can find out more about these by visiting http://www.m3.org.

This chapter of the Handbook of Programming Languages includes the entire language definition for Modula-3.


Previous Table of Contents Next