Mobile Software Engineering

2007-11-21 by tamberg

Knowing Oberon Modules

Before we switched to C#, we used our own programming language Component Pascal, a dialect of Niklaus Wirth’s Oberon. Published in 1988, Oberon’s feature set is similar to those of the early Java and C# versions, with an important exception. The module concept which Wirth officially introduced with Modula-2 and later refined in Oberon to provide language support for modularization.

The Component Pascal language report states that

A module is a collection of declarations of constants, types, variables, and procedures, together with a sequence of statements for the purpose of assigning initial values to the variables. A module constitutes a text that is compilable as a unit.[…]

A module also defines a scope of visibility for it's members. To be accessible outside of a module, a member must be marked as exported. To access the exported members of another module, a client module must refer to the other module as imported. Mutual imports of modules are not allowed. As modules are the only unit of compilation, every valid program is structured into one or more modules with clearly stated dependencies.