A module is a description of a singular object. A singular object generated from a module is called a module object.
Modules are organized in a hierarchical structure defined by the nesting of modules that follow the general mechanism of nesting in qBeta. The modules are named using reverse URL’s. The organization of modules is inspired by the organization of Java packages.
The top module is called BETAworld. Below is shown some of the modules in the BETAworld structure:
BETAworld: obj
Beta: obj
-- The core elements of qBeta
LIB: obj
-- The basic modules of qBeta
BasisSystem: obj
-- modules for supporting concurrency
Collections: obj
-- Collection modules
dk: obj
-- Example modules from Danish organizations
org: obj
-- Example modules from org-domains.
workspace: obj
-- A working module for local programs
A program is also a module like. As an example, the module myProgram
below may be a nested module within the workspace
module.
myProgram: obj
V: ref String
V := "Hello world"
V.print
When the compiler qbeta
is invoked on a module like myProgram
:
qbeta myProgram
All modules being used by myProgram
are also compiled, and instantiated in some unspecified order. And since a module is a singular object, these modules are executed as part of the instantiation. The main-part of a module is thus intended for initialization. All code in a library module that should not be executed as part of the initialization should thus be encapsulated in patterns
The hierarchical structure of modules is mapped to a hierarchical directory- and file structure.