Modula-3 Frequently Asked Questions


The language

What is Modula-3?

Modula-3 is a systems programming language that descends from Mesa, Modula-2, Cedar, and Modula-2+. It also resembles its cousins Object Pascal, Oberon, and Euclid.

The goal of Modula-3 is to be as simple and safe as it can be while meeting the needs of modern systems programmers. Instead of exploring new features, we studied the features of the Modula family of languages that have proven themselves in practice and tried to simplify them into a harmonious language. We found that most of the successful features were aimed at one of two main goals: greater robustness, and a simpler, more systematic type system.

Modula-3 retains one of Modula-2's most successful features, the provision for explicit interfaces between modules. It adds objects and classes, exception handling, garbage collection, lightweight processes (or threads), and the isolation of unsafe features.

Is Modula-3 a superset of Modula-2?

No; valid Modula-2 programs are not valid Modula-3 programs. However, there is a tool to help convert Modula-2 programs to Modula-3.


The documentation

Where can I get a description of Modula-3?

The definition of Modula-3 is contained in: "System Programming with Modula-3" also known as SPwM3.

Chapters 2 and 3 have been reprinted in Sigplan Notices, Volume 27, Number 8, August 1992, pp 15-42.

Sam Harbison has written a more tutorial book titled Modula3. The errata sheet is available via anonymous ftp from gatekeeper.dec.com and its mirrors in pub/DEC/Modula-3/errata.

Where can I get other information on Modula-3?

There is a Usenet newsgroup, comp.lang.modula3.

A more extensive Modula-3 bibliography is available here.


The implementations

Where can I get an implementation?

Three implementations are available, SRC Modula-3 and two PC versions, m3pc and M3forDOS.

Apparently work on GNU Modula-3 has stopped.

As far as we know, implementations are not available for VMS or Macintosh.

What is SRC Modula-3?

SRC Modula-3 was built by the DEC Systems Reseach Center and is available via anonymous ftp from gatekeeper.dec.com and its mirrors in pub/DEC/Modula-3/release-X.Y.

What is m3pc?

m3pc is a port of SRC Modula-3 version 2.11 to a PC running MSDOS.

What is M3forDOS?

M3forDOS is a port of SRC Modula-3 version 3.1 to a PC running MSDOS. ex32 is the name of the DOS extender used by that system.

What is GNU Modula-3?

GNU Modula-3 was an independent implementation that was to be fully integrated with gcc.


Some specific questions

Why is "Hello World" so large?

Modula-3 programs are larger than C programs for the following reasons:

  1. The fixed runtime is substantially larger. It contains a garbage collector, a thread runtime, and exception support. Note that "Hello World" is virtually all runtime. For larger programs the runtime is not an issue.
  2. The generated code includes runtime checks for out-of-bound array references and NIL pointer. Many of these checks could be removed by a better compiler. The current compiler is only a research prototype.
  3. The compiler generates C code as its intermediate language consequently the final machine code suffers. For example, the compiler is constantly storing single-precision floating point values into memory to get around C's predisposition for double precision.

Why objects and interfaces?

Allan Heydon on comp.lang.modula3, May 4th 1993:

Modula-3 provides two separate mechanisms for data-hiding: one for hiding details about how interfaces are implemented, and the other for hiding details about how objects are implemented.

The first data-hiding mechanism is realized by the distinction between interfaces and modules. Clients can only import interfaces, so the names declared in the modules implementing those interfaces are hidden from clients. Note that this mechanism has only two levels; a name is either declared in an interface, or it isn't. If a name is only declared in a module, it can't be used by a client.

The second data-hiding mechanism is realized by opaque types and revelations. A Modula-3 interface may declare an object type to be opaque, in which case only a subset of the fields and methods of that object are revealed to clients importing the interface. Furthermore, the Modula-3 revelation mechanism allows a designer to reveal successively more fields and methods of an object in a series of interfaces. The fields and methods visible to a client then depends on which interfaces the client imports.

The latter mechanism is quite flexible. As opposed to the interface/module data-hiding mechanism, opaque types allow you to define an arbitrary number of levels at which more and more information about the implementation of your object is revealed.

See Sections 2.2.10, 2.4.6, and 2.4.7 of "Systems Programming with Modula-3" for more information about opaque types and about partial and complete revelations.

What is the story with Trestle and OpenWindows?

Mark Manasse says:

I think that the OpenWindows release should be enough (no need to get the MIT X release], although there are a few things in Trestle that trigger devastating bugs in OpenWindows. But the only library we depend on is Xlib, R4 or later.

The main thing I know that crashes OW 2.0 is the code where we call GrabKey specifying AnyKey. You can either loop over all of the keys, or you can just comment out the call; programs won't run exactly the same, but you probably won't notice the difference.

When is the next release of SRC Modula-3?

The next release will be called 3.5.4 (or 3.6). At this time there is no scheduled release date.


FTP

What if I don't have ftp access?

Unfortunately, we cannot deliver Modula-3 other than by anonymous ftp.

Fortunately, Prime Time Freeware (PTF) includes Modula-3. PTF is a set of two ISO-9660 CDroms filled with 3GB of freeware, issued semi-annually. The latest issue, Volume 1, Number 2, July 1992, contains SRC Modula-3 2.07. PTF is distributed via bookstores and mail. You can reach PTF using:

    Email:  ptf@cfcl.com
    Fax:    [1] (408) 738 2050
    Voice:  [1] (408) 738 4832
    Mail:   Prime Time Freeware
    415-112 N. Mary Ave., Suite 50
    Sunnyvale, CA 94086
    USA

Contributing

Can I contribute Modula-3 software?

Certainly. Send us what you are willing to share, be it programs, libraries or other things. We'll put them in the distribution.

Right now, the pub/DEC/Modula-3/contrib directory contains:

    m3rpc     an rpc system from Xerox Parc
    M2toM3    a translator from Modula-2 to Modula-3
    m3pc      an implementation of Modula-3 (v2.11) for PCs
    M3forDOS  an implementation of Modula-3 (v3.1) for PCs.

[Modula-3 home page]

m3-request@src.dec.com
Last modified on Thu Jan  4 11:08:07 PST 1996 by heydon
     modified on Thu Jun 15 15:32:23 PDT 1995 by kalsow
Copyright (C) 1992, 1996, Digital Equipment Corporation. All rights reserved.
See the COPYRIGHT for a full description.