www.modula7.org - Official Website of the Modula-7 Programming Language
Modula-7 Overview

By Andrew J. Wozniewicz
Milwaukee, June 1, 2007

Modula-7 is an object-oriented programming language in which a module is the essential primary concept, the most fundamental building block. Module is all there is to Modula-7 programs - everything else is commentary. A module is a combination of data and code (state and operations).

Modules in Modula-7 come in different flavors, such as functions, objects, classes, and - well - modules (actual syntax elements in the language).

Modula-7 continues the tradition of Algol-like, block-structured (i.e. "inherently readable") programming languages (such as Pascal, Modula‑2, Modula‑3, Oberon), being especially influenced by the modern incarnations of Pascal such as Delphi Object Pascal by Borland, while picking up good ideas from a wide variety of other languages, including (not in any particular order) Java, C++, C#, C, Python, Eiffel, E, Ada, and others. It has been conceived as a successor to — and an upgrade from — those other languages.

Modula-7 is both an application-, and a systems-programming language; potentially a compiled, as well as an interpreted language suitable for scripting.

Modula-7 is intended for many kinds of programming projects, from teaching fundamentals of programming to students, to supporting individual/hobbyist efforts of a single programmer, to large-scale projects undertaken by teams of software engineers, to being embeddable as a scripting language in end-user applications. The language is intended to be simple for simple tasks, while being immensely powerful when the power is required.

Of at least equal importance is that the language be readable and lend itself to writing elegant, easily maintainable programs, regardless of their size and complexity, which is more than can be said about many-a-programming-language in widespread use today.

As the starting point of the exploration of the Modula-7 language, and in a time-honored tradition of programming language tutorials, it is now appropriate to introduce one of the simplest programs in any language, the venerable HelloWorld application:

module HelloWorld;
  WriteLn("Hello World!");

In all fairness, this is not THE simplest Modula-7 program, nor is it even the simplest "Hello-World"-type program in this language. The simplest "Hello-World" program in Modula-7 is just a one-liner:

WriteLn("Hello World!");

The (default) module declarations are all implied in the above single-line, such that this one line is exactly equivalent to the 3-line HelloWorld module fully-spelled out. That's how simple simple tasks should be.

On the other hand, Modula-7 is fully equipped to handle even the most complex programming projects, with support for separately compilable modules (that act like namespaces in other languages), full support for object-orientation, aspect-oriented programming, built-in concurrent programming features, exception handling, and a lot more.

The language was designed by Andrew J. Wozniewicz at Optimax Corporation in a progressive series of attempts to incorporate the latest features and concepts from the different programming languages that made their appearance in the 1990's and beyond.

The name "Modula" for the language has been deliberately chosen to clearly indicate its heritage (Modula-2 was supposed to be an improvement over Pascal), while the number 7 — beyond being "magic" in many cultures — by virtue of being an increment of magnitude greater than one starting from 2, indicates a clean break with the limitations of Modula-2 and its immediate successors. It also represents the numerous failed prior attempts to create a better mouse-trap.. er.. language by its designer.

It may also have something to do with the fact that the language design was finalized in the year 2007.

"High thoughts must have a high language." [Aristophanes]