Next: Modules - Global Data
Up: Modules
Previous: Modules
The syntax of a module program unit is:
MODULE < module name >
< declarations and specifications statements >
[ CONTAINS
< definitions of module procedures > ]
END [ MODULE [ < module name > ] ]
< module name > is the name that appears in the USE statement,
it is not necessarily the same as the filename.
Figure 24: Schematic Diagram of a Module Program Unit
Entities of other modules can be accessed by a USE
statement as the first statement in the
specification part. This is called use-association.
Non-circular dependent definition chains are allowed
(one module USE s another which USE s
another and so on) providing a partial-inheritance mechanism.
A module may include the following declarations and specifications:
- USE statements (a module
inherit the environment of another module either
fully or partially by using USE .. ONLY clause,)
- object definitions, (any declarations and definitions
that could appear in a main program can also be found here),
- object initialisations,
- type definitions,
- accessibility statements,
- interface declarations (of external procedures);
- MODULE PROCEDURE declarations (procedures that appear
after the CONTAINS specifier).
Module procedures are written in exactly the same way as regular
(external) procedures and may also contain internal procedures. They can
be given visibility attributes so may be private to the module or usable
by any program unit that employs the module.
Return to corresponding overview page
Next: Modules - Global Data
Up: Modules
Previous: Modules
©University of Liverpool, 1997
Wed May 28 20:20:27 BST 1997Not for commercial use.