HOME

TheInfoList



OR:

Modula-3 is a
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
conceived as a successor to an upgraded version of
Modula-2 Modula-2 is a structured, procedural programming language developed between 1977 and 1985/8 by Niklaus Wirth at ETH Zurich. It was created as the language for the operating system and application software of the Lilith personal workstation. It w ...
known as
Modula-2+ Modula-2+ is a programming language descended from the Modula-2 language. It was developed at DEC Systems Research Center (SRC) and Acorn Computers Ltd Research Centre in Palo Alto, California. Modula-2+ is Modula-2 with exceptions and threads. ...
. While it has been influential in research circles (influencing the designs of languages such as
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
, C#, and
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (pro ...
) it has not been adopted widely in industry. It was designed by
Luca Cardelli Luca Andrea Cardelli, Fellow of the Royal Society (FRS), is an Italian computer scientist who is a research professor at the University of Oxford in Oxford, UK. Cardelli is well known for his research in type theory and operational semantics. A ...
, James Donahue, Lucille Glassman, Mick Jordan (before at the
Olivetti Olivetti S.p.A. is an Italian manufacturer of computers, tablets, smartphones, printers and other such business products as calculators and fax machines. Headquartered in Ivrea, in the Metropolitan City of Turin, the company has been part of ...
Software Technology Laboratory), Bill Kalsow and Greg Nelson at the
Digital Equipment Corporation Digital Equipment Corporation (DEC ), using the trademark Digital, was a major American company in the computer industry from the 1960s to the 1990s. The company was co-founded by Ken Olsen and Harlan Anderson in 1957. Olsen was president unt ...
(DEC) Systems Research Center (SRC) and the
Olivetti Olivetti S.p.A. is an Italian manufacturer of computers, tablets, smartphones, printers and other such business products as calculators and fax machines. Headquartered in Ivrea, in the Metropolitan City of Turin, the company has been part of ...
Research Center (ORC) in the late 1980s. 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 Generic programming is a style of computer programming in which algorithms are written in terms of types ''to-be-specified-later'' that are then ''instantiated'' when needed for specific types provided as parameters. This approach, pioneered b ...
(similar to
templates Template may refer to: Tools * Die (manufacturing), used to cut or shape material * Mold, in a molding process * Stencil, a pattern or overlay used in graphic arts (drawing, painting, etc.) and sewing to replicate letters, shapes or designs Co ...
), multithreading,
exception handling In computing and computer programming, exception handling is the process of responding to the occurrence of ''exceptions'' – anomalous or exceptional conditions requiring special processing – during the execution of a program. In general, an ...
,
garbage collection Waste collection is a part of the process of waste management. It is the transfer of solid waste from the point of use and disposal to the point of treatment or landfill. Waste collection also includes the curbside collection of recyclabl ...
,
object-oriented programming Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of pr ...
, partial revelation, and explicit marking of unsafe code. The design goal of Modula-3 was a language that implements the most important features of modern
imperative programming In computer science, imperative programming is a programming paradigm of software that uses statements that change a program's state. In much the same way that the imperative mood in natural languages expresses commands, an imperative program c ...
languages in quite basic forms. Thus allegedly dangerous and complicating features such as
multiple inheritance Multiple inheritance is a feature of some object-oriented computer programming languages in which an object or class can inherit features from more than one parent object or parent class. It is distinct from single inheritance, where an object or ...
and
operator overloading In computer programming, operator overloading, sometimes termed ''operator ad hoc polymorphism'', is a specific case of polymorphism, where different operators have different implementations depending on their arguments. Operator overloading is ...
were omitted.


Historical development

The Modula-3 project started in November 1986 when Maurice Wilkes wrote to
Niklaus Wirth Niklaus Emil Wirth (born 15 February 1934) is a Swiss computer scientist. He has designed several programming languages, including Pascal (programming language), Pascal, and pioneered several classic topics in software engineering. In 1984, he w ...
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 Oberon () is a king of the fairies in medieval and Renaissance literature. He is best known as a character in William Shakespeare's play ''A Midsummer Night's Dream'', in which he is King of the Fairies and spouse of Titania, Queen of the Fairi ...
, but had no problems with Wilkes's 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. Its design was heavily influenced by work on the
Modula-2+ Modula-2+ is a programming language descended from the Modula-2 language. It was developed at DEC Systems Research Center (SRC) and Acorn Computers Ltd Research Centre in Palo Alto, California. Modula-2+ is Modula-2 with exceptions and threads. ...
language in use at SRC and at the
Acorn Computers Acorn Computers Ltd. was a British computer company established in Cambridge, England, in 1978. The company produced a number of computers which were especially popular in the UK, including the Acorn Electron and the Acorn Archimedes. Acorn's ...
Research Center (ARC, later ORC when Olivetti acquired Acorn) at the time, which was the language in which the operating system for the
DEC Firefly The Firefly was a shared memory asymmetric multiprocessor workstation, developed by the Systems Research Center, a research organization within Digital Equipment Corporation. The first version built contained up to seven MicroVAX 78032 microproc ...
multiprocessor
VAX VAX (an acronym for Virtual Address eXtension) is a series of computers featuring a 32-bit instruction set architecture (ISA) and virtual memory that was developed and sold by Digital Equipment Corporation (DEC) in the late 20th century. The V ...
workstation was written and in which the Acorn Compiler for Acorn C and Modula Execution Library (CAMEL) at ARC for the
ARX Arx, ARX, or ArX may refer to: *ARX (Algorithmic Research Ltd.), a digital security company *ARX (gene), Aristaless related homeobox *ARX (operating system), an operating system *ArX (revision control), revision control software *Arx (Roman), a Ro ...
operating system project of
ARM In human anatomy, the arm refers to the upper limb in common usage, although academically the term specifically means the upper arm between the glenohumeral joint (shoulder joint) and the elbow joint. The distal part of the upper limb between th ...
based
Acorn Archimedes Acorn Archimedes is a family of personal computers designed by Acorn Computers of Cambridge, England. The systems are based on Acorn's own ARM architecture processors and the proprietary operating systems Arthur and RISC OS. The first mode ...
range of computers was written. As the revised Modula-3 Report states, the language was influenced by other languages such as
Mesa A mesa is an isolated, flat-topped elevation, ridge or hill, which is bounded from all sides by steep escarpments and stands distinctly above a surrounding plain. Mesas characteristically consist of flat-lying soft sedimentary rocks capped by ...
,
Cedar Cedar may refer to: Trees and plants *''Cedrus'', common English name cedar, an Old-World genus of coniferous trees in the plant family Pinaceae *Cedar (plant), a list of trees and plants known as cedar Places United States * Cedar, Arizona * ...
,
Object Pascal Object Pascal is an extension to the programming language Pascal (programming language), Pascal that provides object-oriented programming (OOP) features such as Class (computer programming), classes and Method (computer programming), methods. ...
,
Oberon Oberon () is a king of the fairies in medieval and Renaissance literature. He is best known as a character in William Shakespeare's play ''A Midsummer Night's Dream'', in which he is King of the Fairies and spouse of Titania, Queen of the Fairi ...
and
Euclid Euclid (; grc-gre, Wikt:Εὐκλείδης, Εὐκλείδης; BC) was an ancient Greek mathematician active as a geometer and logician. Considered the "father of geometry", he is chiefly known for the ''Euclid's Elements, Elements'' trea ...
.Modula-3 report (revised)
Luca Cardelli, James Donahue, Lucille Glassman, Mick Jordan, Bill Kalsow, Greg Nelson.
DEC Systems Research Center The Systems Research Center (SRC) was a research laboratory created by Digital Equipment Corporation (DEC) in 1984, in Palo Alto, California. DEC SRC was founded by a group of computer scientists, led by Robert Taylor, who left the Computer ...
(SRC) Research Report 52 (November 1989)
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 (especially when it ceased to maintain it effectively before DEC was sold to
Compaq Compaq Computer Corporation (sometimes abbreviated to CQ prior to a 2007 rebranding) was an American information technology company founded in 1982 that developed, sold, and supported computers and related products and services. Compaq produced ...
in 1998). 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 Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of pr ...
. For a time, a commercial
compiler In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs that ...
named CM3 maintained by one of the chief implementors prior at DEC SRC who was hired before DEC being sold to
Compaq Compaq Computer Corporation (sometimes abbreviated to CQ prior to a 2007 rebranding) was an American information technology company founded in 1982 that developed, sold, and supported computers and related products and services. Compaq produced ...
, an
integrated development environment An integrated development environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of at least a source code editor, build automation tools a ...
(IDE) named Reactor and an extensible Java virtual machine (licensed in binary code and
source code In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the wo ...
formats and buildable with Reactor) were offered by Critical Mass, Inc., but that company ceased active operations in 2000 and gave some of the source code of its products to Software Solutions GmbH. Modula-3 is now taught in universities mostly in comparative programming language courses, and its textbooks are out of print. Essentially the only corporate supporter of Modula-3 is , which inherited the sources from Critical Mass and has since made several releases of the CM3 system in source and binary code. The Reactor IDE has been open source released after several years it had not, with the new name CM3-IDE. In March 2002, also took over the repository of another active Modula-3 distribution, PM3, until then maintained at the
École Polytechnique de Montréal École may refer to: * an elementary school in the French educational stages normally followed by secondary education Secondary education or post-primary education covers two phases on the International Standard Classification of Education scal ...
but which later continued by the work on HM3 improved over the years later until it was obsoleted.


Syntax

A common example of a language's
syntax In linguistics, syntax () is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure ( constituency) ...
is the "Hello, World!" program. MODULE Main; IMPORT IO; BEGIN IO.Put("Hello World\n") END Main. All programs in Modula-3 have at least a module file, while most also include an interface file that is used by clients to access data from the module. As in some other languages, a Modula-3 program must export a Main module, which can either be a file named Main.m3, or a file can call EXPORT to export the Main module. MODULE Foo EXPORTS Main Module file names are advised to be the same as the name in source code. If they differ, the compiler only emits a warning. Other conventions in the syntax include naming the exported type of an interface T, since types are usually qualified by their full names, so a type T inside a module named Foo will be named Foo.T. This aids in readability. Another similar convention is naming a public object Public as in the OOP examples below.


Language features


Modularity

First and foremost, all compiled units are either INTERFACE or implementation MODULEs, of one flavor or another. An interface compiled unit, starting with the keyword INTERFACE, defines constants, types, variables, exceptions, and procedures. The implementation module, starting with the keyword MODULE, provides the code, and any further constants, types, or variables needed to implement the interface. By default, an implementation module will implement the interface of the same name, but a module may explicitly EXPORT to a module not of the same name. For example, the main program exports an implementation module for the Main interface. MODULE HelloWorld EXPORTS Main; IMPORT IO; BEGIN IO.Put("Hello World\n") END HelloWorld. Any compiled unit may IMPORT other interfaces, although circular imports are forbidden. This may be resolved by doing the import from the implementation MODULE. The entities within the imported module may be imported, instead of only the module name, using the FROM Module IMPORT Item Item syntax: MODULE HelloWorld EXPORTS Main; FROM IO IMPORT Put; BEGIN Put("Hello World\n") END HelloWorld. Typically, one only imports the interface, and uses the 'dot' notation to access the items within the interface (similar to accessing the fields within a record). A typical use is to define one
data structure In computer science, a data structure is a data organization, management, and storage format that is usually chosen for efficient access to data. More precisely, a data structure is a collection of data values, the relationships among them, a ...
(record or object) per interface along with any support procedures. Here the main type will get the name 'T', and one uses as in MyModule.T. In the event of a name collision between an imported module and other entity within the module, the reserved word AS can be used as in IMPORT CollidingModule AS X;


Safe vs unsafe

Some ability is deemed unsafe, where the compiler can no longer guarantee that results will be consistent; for example, when interfacing to the C language. The keyword UNSAFE prefixed in front of INTERFACE or MODULE, may be used to tell the compiler to enable certain low level features of the language. For example, an unsafe operation is bypassing the type system using LOOPHOLE to copy the bits of an integer into a floating point REAL number. An interface that imports an unsafe module must also be unsafe. A safe interface may be exported by an unsafe implementation module. This is the typical use when interfacing to external
libraries A library is a collection of materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or digital access (soft copies) materials, and may be a physical location or a vir ...
, where two interfaces are built: one unsafe, the other safe.


Generics

A generic interface and its corresponding generic module, prefix the INTERFACE or MODULE keyword with GENERIC, and take as formal arguments other interfaces. Thus (like
C++ templates C, or c, is the third letter in the Latin alphabet, used in the modern English alphabet, the alphabets of other western European languages and others worldwide. Its name in English is ''cee'' (pronounced ), plural ''cees''. History "C" ...
) one can easily define and use abstract data types, but unlike
C++ C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
, the granularity is at the module level. An interface is passed to the generic interface and implementation modules as arguments, and the compiler will generate concrete modules. For example, one could define a GenericStack, then instantiate it with interfaces such as IntegerElem, or RealElem, or even interfaces to Objects, as long as each of those interfaces defines the properties needed by the generic modules. The bare types INTEGER, or REAL can't be used, because they are not modules, and the system of generics is based on using modules as arguments. By comparison, in a C++ template, a bare type would be used. FILE: IntegerElem.i3 INTERFACE IntegerElem; CONST Name = "Integer"; TYPE T = INTEGER; PROCEDURE Format(x: T): TEXT; PROCEDURE Scan(txt: TEXT; VAR x: T): BOOLEAN; END IntegerElem. FILE: GenericStack.ig GENERIC INTERFACE GenericStack(Element); (* Here Element.T is the type to be stored in the generic stack. *) TYPE T = Public OBJECT; Public = OBJECT METHODS init(): TStack; format(): TEXT; isEmpty(): BOOLEAN; count(): INTEGER; push(elm: Element.T); pop(VAR elem: Element.T): BOOLEAN; END; END GenericStack. FILE: GenericStack.mg GENERIC MODULE GenericStack(Element); < ... generic implementation details... > PROCEDURE Format(self: T): TEXT = VAR str: TEXT; BEGIN str := Element.Name & "Stack;"; RETURN str; END Format; < ... more generic implementation details... > END GenericStack. FILE: IntegerStack.i3 INTERFACE IntegerStack = GenericStack(IntegerElem) END IntegerStack. FILE: IntegerStack.m3 MODULE IntegerStack = GenericStack(IntegerElem) END IntegerStack.


Traceability

Any identifier can be traced back to where it originated, unlike the 'include' feature of other languages. A compiled unit must import identifiers from other compiled units, using an IMPORT statement. Even enumerations make use of the same 'dot' notation as used when accessing a field of a record. INTERFACE A; TYPE Color = ; END A; MODULE B; IMPORT A; FROM A IMPORT Color; VAR aColor: A.Color; (* Uses the module name as a prefix *) theColor: Color; (* Does not have the module name as a prefix *) anotherColor: A.Color; BEGIN aColor := A.Color.Brown; theColor := Color.Red; anotherColor := Color.Orange; (* Can't simply use Orange *) END B.


Dynamic allocation

Modula-3 supports the allocation of data at runtime. There are two kinds of memory that can be allocated, TRACED and UNTRACED, the difference being whether the
garbage collector A waste collector, also known as a garbageman, garbage collector, trashman (in the US), binman or (rarely) dustman (in the UK), is a person employed by a public or private enterprise to collect and dispose of municipal solid waste (refuse) and r ...
can see it or not. NEW() is used to allocate data of either of these classes of memory. In an UNSAFE module, DISPOSE is available to free untraced memory.


Object-oriented

Object-oriented programming techniques may be used in Modula-3, but their use is not needed. Many of the other features provided in Modula-3 (modules, generics) can usually take the place of object-orientation. Object support is intentionally kept to its simplest terms. An object type (termed a "class" in other object-oriented languages) is introduced with the OBJECT declaration, which has essentially the same syntax as a RECORD declaration, although an object type is a reference type, whereas RECORDs in Modula-3 are not (similar to structs in C). Exported types are usually named T by convention, and create a separate "Public" type to expose the methods and data. For example: INTERFACE Person; TYPE T <: Public; Public = OBJECT METHODS getAge(): INTEGER; init(name: TEXT; age: INTEGER): T; END; END Person. This defines an interface Person with two types, T, and Public, which is defined as an object with two methods, getAge() and init(). T is defined as a subtype of Public by the use of the <: operator. To create a new Person.T object, use the built in procedure NEW with the method init() as VAR jim := NEW(Person.T).init("Jim", 25); 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''. Use REVEAL to show the full implementation of the Person interface from above. MODULE Person; REVEAL T = Public BRANDED OBJECT name: TEXT; (* These two variables *) age: INTEGER; (* are private. *) OVERRIDES getAge := Age; init := Init; END; PROCEDURE Age(self: T): INTEGER = BEGIN RETURN self.age; END Age; PROCEDURE Init(self: T; name: TEXT; age: INTEGER): T = BEGIN self.name := name; self.age := age; RETURN self; END Init; BEGIN END Person. Note the use of the BRANDED keyword, which "brands" objects to make them unique as to avoid structural equivalence. BRANDED can also take a string as an argument, but when omitted, a unique string is generated for you. Modula-3 is one of a few programming languages which requires external references from a module to be strictly qualified. That is, a reference in module A to the object x exported from module B must take the form B.x. In Modula-3, it is impossible to import ''all exported names'' from a module. Because of the language's requirements on name qualification and
method overriding Method overriding, in object-oriented programming, is a language feature that allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its superclasses or parent classes. In addition to ...
, 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 with no worries about naming conflicts; and it also makes it possible to edit core language libraries with the firm knowledge that no extant program will be ''broken'' in the process.


Exceptions

Exception handling In computing and computer programming, exception handling is the process of responding to the occurrence of ''exceptions'' – anomalous or exceptional conditions requiring special processing – during the execution of a program. In general, an ...
is based on a TRY...EXCEPT block system, which has since become common. One feature that has not been adopted in other languages, with the notable exceptions of
Delphi Delphi (; ), in legend previously called Pytho (Πυθώ), in ancient times was a sacred precinct that served as the seat of Pythia, the major oracle who was consulted about important decisions throughout the ancient classical world. The oracle ...
, Python

Scala

and
Visual Basic.NET Visual Basic, originally called Visual Basic .NET (VB.NET), is a multi-paradigm, object-oriented programming language, implemented on .NET, Mono, and the .NET Framework. Microsoft launched VB.NET in 2002 as the successor to its original Vis ...
, is that the EXCEPT construct defined a form of switch statement with each possible exception as a case in its own EXCEPT clause. Modula-3 also supports a LOOP...EXIT...END construct that loops until an EXIT occurs, a structure equivalent to a simple loop inside a TRY...EXCEPT clause.


Multi-threaded

The language supports the use of multi-threading, and synchronization between threads. There is a standard module within the
runtime library In computer programming, a runtime library is a set of low-level routines used by a compiler to invoke some of the behaviors of a runtime environment, by inserting calls to the runtime library into compiled executable binary. The runtime enviro ...
(''m3core'') named Thread, which supports the use of multi-threaded applications. The Modula-3 runtime may make use of a separate thread for internal tasks such as garbage collection. A built-in data structure
MUTEX In computer science, a lock or mutex (from mutual exclusion) is a synchronization primitive: a mechanism that enforces limits on access to a resource when there are many threads of execution. A lock is designed to enforce a mutual exclusion concur ...
is used to synchronize multiple threads and protect data structures from simultaneous access with possible corruption or race conditions. The LOCK statement introduces a block in which the mutex is locked. Unlocking a MUTEX is implicit by the code execution locus's leaving the block. The MUTEX is an object, and as such, other objects may be derived from it. For example, in the
input/output In computing, input/output (I/O, or informally io or IO) is the communication between an information processing system, such as a computer, and the outside world, possibly a human or another information processing system. Inputs are the signals ...
(I/O) section of the library ''libm3'', readers and writers (Rd.T, and Wr.T) are derived from MUTEX, and they lock themselves before accessing or modifying any internal data such as buffers.


Summary

In summary, the language features: *
Modules Broadly speaking, modularity is the degree to which a system's components may be separated and recombined, often with the benefit of flexibility and variety in use. The concept of modularity is used primarily to reduce complexity by breaking a s ...
and interfaces *Explicit marking of unsafe code * Generics *Automatic
garbage collection Waste collection is a part of the process of waste management. It is the transfer of solid waste from the point of use and disposal to the point of treatment or landfill. Waste collection also includes the curbside collection of recyclabl ...
* Strong typing, structural equivalence of types *
Objects Object may refer to: General meanings * Object (philosophy), a thing, being, or concept ** Object (abstract), an object which does not exist at any particular time or place ** Physical object, an identifiable collection of matter * Goal, an ...
* Exceptions * Threads 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, and parameter modes like READONLY.


Standard library features

Continuing a trend started with the C language, many of the features needed to write real programs were left out of the language definition and instead provided via a
standard library In computer programming, a standard library is the library made available across implementations of a programming language. These libraries are conventionally described in programming language specifications; however, contents of a language's as ...
set. Most of the interfaces below are described in detail inSome Useful Modula-3 Interfaces
Jim Horning, Bill Kalsow, Paul McJones, Greg Nelson.
DEC Systems Research Center The Systems Research Center (SRC) was a research laboratory created by Digital Equipment Corporation (DEC) in 1984, in Palo Alto, California. DEC SRC was founded by a group of computer scientists, led by Robert Taylor, who left the Computer ...
(SRC) Research Report 113 (December 1993)
Standard libraries providing the following features. These are called standard interfaces and are required (must be provided) in the language. * Text: Operations on immutable string references, called TEXTs * Thread: Operations relating to threading, including MUTEX, condition variable, and thread pausing. The threading library provides pre-emptive threads switching * Word: Bitwise operations on unsigned integers (or machine words). Normally implemented directly by the compiler * Floating-point interfaces Some recommended interfaces implemented in the available implementations but are not required * Lex: For parsing number and other data * Fmt: Formatting various datatypes for printing * Pkl (or Pickle): Object serialization of any reference types reachable by the garbage collector * Table: Generic modules for
maps A map is a symbolic depiction emphasizing relationships between elements of some space, such as objects, regions, or themes. Many maps are static, fixed to paper or some other durable medium, while others are dynamic or interactive. Although ...
As in C, I/O is also provided via libraries, in Modula-3 called Rd and Wr. The object-oriented design of the Rd (readers) and Wr (writers) 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 which standard libraries have been formally verified not to contain various types of bugs, including locking bugs. This was done under the auspices of the Larch/Modula-3 (see
Larch family The Larch family of formal specification languages are intended for the precise specification of computing systems. They allow the clean specification of computer programs and the formulation of proofs about program behavior. The Larch family was ...
)LM3
Kevin D. Jones.
DEC Systems Research Center The Systems Research Center (SRC) was a research laboratory created by Digital Equipment Corporation (DEC) in 1984, in Palo Alto, California. DEC SRC was founded by a group of computer scientists, led by Robert Taylor, who left the Computer ...
(SRC) Research Report 72 (June 1991)
and Extended static checkingExtended Static Checking
David L. Detlefs, K. Rustan M. Leino, Greg Nelson, James B. Saxe. Compaq SRC Research Report 159 (December 1998)
projects at
DEC Systems Research Center The Systems Research Center (SRC) was a research laboratory created by Digital Equipment Corporation (DEC) in 1984, in Palo Alto, California. DEC SRC was founded by a group of computer scientists, led by Robert Taylor, who left the Computer ...
.


Implementations

Several compilers are available, most of them
open source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
. *DEC-SRC M3, the original. *Olivetti Research Center (ORC) Modula-3 toolkit, originally a compiler, now available as a library for syntactic, lexical and semantic analysis of Modula-3 programs. *Critical Mass CM3, a different successor of DEC-SRC M3 *Polytechnique Montreal Modula-3 PM3, a successor of DEC-SRC M3, currently merging with CM3 *EzM3, an independent lightweight and easily portable implementation, developed in connection with CVSup *HM3, a successor of the pm3-1.1.15 release of PM3, with support of native threading using
NPTL The Native POSIX Thread Library (NPTL) is an implementation of the POSIX Threads specification for the Linux operating system. History Before the 2.6 version of the Linux kernel, processes were the schedulable entities, and there were no special f ...
*CM3, the successor to Critical Mass CM3. This is the only up to date, maintained and developed implementation. Releases are available from http://www.opencm3.net/releng/. Since the only aspect of C data structures that is missing from Modula-3 is the union type, all extant Modula-3 implementations are able to provide good binary code compatibility with C language type declarations of
arrays An array is a systematic arrangement of similar objects, usually in rows and columns. Things called an array include: {{TOC right Music * In twelve-tone and serial composition, the presentation of simultaneous twelve-tone sets such that the ...
and structs.


Books

None of these books are still in print, although used copies are obtainable and some are digitized, partly or fully, and some chapters of one them have prior or posterior versions obtainable as research reports from the web. *Greg Nelson, ed., ''Systems Programming with Modula-3'' The definitive reference on the Modula-3 language with interesting articles on object-oriented systems software construction and a documentation of the discussion leading to the final features of the language. There are some formerly (see for Chapter two,An Introduction to Programming with Threads
Andrew D. Birrell.
DEC Systems Research Center The Systems Research Center (SRC) was a research laboratory created by Digital Equipment Corporation (DEC) in 1984, in Palo Alto, California. DEC SRC was founded by a group of computer scientists, led by Robert Taylor, who left the Computer ...
(SRC) Research Report 35 (January 1989)
for chapter four,Synchronization Primitives for a Multiprocessor: A Formal Specification
A. D. Birrell, J. V. Guttag, J. J. Horning, R. Levin.
DEC Systems Research Center The Systems Research Center (SRC) was a research laboratory created by Digital Equipment Corporation (DEC) in 1984, in Palo Alto, California. DEC SRC was founded by a group of computer scientists, led by Robert Taylor, who left the Computer ...
(SRC) Research Report 20 (August 1987)
for chapter five,IO Streams: Abstract Types, Real Programs
Mark R. Brown and Greg Nelson.
DEC Systems Research Center The Systems Research Center (SRC) was a research laboratory created by Digital Equipment Corporation (DEC) in 1984, in Palo Alto, California. DEC SRC was founded by a group of computer scientists, led by Robert Taylor, who left the Computer ...
(SRC) Research Report 53 (November 1989)
for chapter six) and some posteriorly (seeModula-3 Reference Manual
Luca Cardelli, James Donahue, Lucille Glassman, Mick Jordan, Bill Kalsow, Greg Nelson.
DEC Systems Research Center The Systems Research Center (SRC) was a research laboratory created by Digital Equipment Corporation (DEC) in 1984, in Palo Alto, California. DEC SRC was founded by a group of computer scientists, led by Robert Taylor, who left the Computer ...
(SRC) (February 1995)
for Chapter one and more updated two, thus of both prior versions of language definition and, for chapter three andTrestle Tutorial
Mark S. Manasse and Greg Nelson.
DEC Systems Research Center The Systems Research Center (SRC) was a research laboratory created by Digital Equipment Corporation (DEC) in 1984, in Palo Alto, California. DEC SRC was founded by a group of computer scientists, led by Robert Taylor, who left the Computer ...
(SRC) Research Report 69 (May 1992)
for chapter seven) of publishing versions of the majority of its eight chapters individually available from prior
DEC Systems Research Center The Systems Research Center (SRC) was a research laboratory created by Digital Equipment Corporation (DEC) in 1984, in Palo Alto, California. DEC SRC was founded by a group of computer scientists, led by Robert Taylor, who left the Computer ...
(SRC) as research reports for download. *Samuel P. Harbison, ''Modula-3'' Easy to use class textbook. * Robert Sedgewick, ''Algorithms in Modula-3'' *Laszlo Boszormenyi & Carsten Weich, ''Programming in Modula-3: An Introduction in Programming with Style'' *Renzo Orsini, Agostino Cortesi ''Programmare in Modula-3: introduzione alla programmazione imperativa e a oggetti'' an Italian book of the language explaining its main features.


Projects using Modula-3

Software which is programmed Modula-3 includes: *The SPIN operating system *The CVSup
software repository A software repository, or repo for short, is a storage location for software packages. Often a table of contents is also stored, along with metadata. A software repository is typically managed by source control or repository managers. Package ...
synchronizing program *The
Obliq Obliq is an interpreted, object-oriented programming language designed to make distributed, and locally multithreaded, computing simpler and easier to program, while providing program safety and an implicit type system. The interpreter is wr ...
language, which uses Modula-3 network objects ability to migrate objects over local networks transparently, allowing a distributed ability to Modula-3 object-oriented programming paradigm. It has been used to build distributed applications, computer animations, and web programming applications in the form of scripting extension to Modula-3.


Influences on other programming languages

Although Modula-3 did not gain mainstream status, several parts of the DEC-SRC M3 distribution did. Probably the most influential part was the Network Objects library, which formed the basis for Java's first Remote Method Invocation (RMI) implementation, including the network protocol. Only when Sun moved from the
Common Object Request Broker Architecture The Common Object Request Broker Architecture (CORBA) is a standard defined by the Object Management Group (OMG) designed to facilitate the communication of systems that are deployed on diverse platforms. CORBA enables collaboration between sys ...
(CORBA) standard to the IIOP based protocol was it dropped. The Java documentation on
garbage collection Waste collection is a part of the process of waste management. It is the transfer of solid waste from the point of use and disposal to the point of treatment or landfill. Waste collection also includes the curbside collection of recyclabl ...
of remote objects still refer to the pioneering work done for Modula-3 Network Objects. Python's implementation of classes was also inspired by the class mechanism found in C++ and Modula-3.''Classes''
Official Python Documentation.
Also the language Nim makes use of some aspects of Modula-3, such as traced vs untraced pointers.


References


External links

* *
CM3 Implementation Website
(now long dead


elego Software Solutions
* ews:comp.lang.modula3 Modula-3 newsgroup mostly deserted
Modula-3 Development Mailing List
active
Notes from Caltech's CS2 class, taught in Modula-3 in 2002 and 2003
*
''Building Distributed OO Applications: Modula-3 Objects at Work''. Michel R. Dagenais. Draft Version (January 1997)
* tp://ftp.u-aizu.ac.jp/pub/lang/Modula/m3/faq/document/LangToolsLibs/root.ps ''Modula-3: Language, Libraries and Tools''. Presentation on Modula-3 over 120 slides. Michael R. Dagenais dead
''Object-Oriented Data Abstraction in Modula-3''. Joseph Bergin (1997)Computerworld Interview with Luca Cardelli on Modula-3
{{Authority control Modula programming language family Object-oriented programming languages Systems programming languages Programming languages created in 1988