Jump to content

Modula-3 programming language

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Mshonle~enwiki (talk | contribs) at 09:24, 17 April 2004 (rm dangling words). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Modula-3 is an extension of the Modula-2 programming language created out by a joint effort by engineers at the DEC Systems Research Center and Olivetti in the late 1980s. Modula-3 aimed to continue the Pascal tradition of type safety, while introducing new constructs for practical real-world programming. In particular Modula-3 adds support for multithreading, exception handling, garbage collection and rudimentary object-oriented programming.

The Modula-3 project started in November 1986 when Maurice Wilkes wrote to Niklaus Wirth with some ideas for a new version of Modula. Wilkes had been working at DEC just prior to this point, and had returned to England and joined Olivetti's Research Strategy Board. Wirth had already moved on to Oberon, but had no problems with the Wilkes' team continuing development under the Modula name. The language definition was completed in August 1988, and an updated version in January 1989. Compilers from DEC and Olivetti soon followed, and 3rd party implementations after that.

Exception handling was based on the now-traditional TRY...EXCEPT block system, the only difference being that the EXCEPT construct defined a pseudo-CASE with each possible exception as a case in one EXCEPT clause. Modula-3 also supported a LOOP...EXCEPT contruct that would loop until an exception occured, a structure equivalent to a simple loop inside of a TRY...EXCEPT clause.

Object support was intentionally kept to its simplst terms. This was introduced with the OBJECT declaration, which was essentially a RECORD with some specific syntax. For instance:

A = OBJECT a: INTEGER; METHODS p() END;

Defines a new class "A", which contains a single field "a" and method p(). p() would have to be defined elsewhere:

PROCEDURE p(self: A) = BEGIN (some code) END;

Method calls are accomplished with o.p;, where o is a variable of type A.

Modula-3's REVEAL construct provides a conceptually simple and clean yet very powerful mechanism for hiding implementation details from clients, with arbitrarily many levels of "friendliness".