Contents | Prev | Next | Index
As in its predecessor Pascal, Modula-2 requires every identifier occuring in a program to be either introduced by a declaration or to be imported. The only exception from this are the standard identifiers which can be regarded as automatically imported. Declarations also specify certain permanent properties of an item, such as whether it is a constant, type, variable or procedure. The identifier is then used to refer to the associated item.
The scope of an item extends textually from the point of its declaration to the end of the block. That is, it is local within its module, procedure or record according to which its declaration belongs to. The visibility of an item also extends to nested scopes unless it is hidden there by another declaration of the same identifier. Here are the scope rules:
An identifier may be qualified. In this case it is prefixed by another idenifier which designates the module (see modules or compilation units) in which the qualified identifier is defined. The prefix and the identifier are separated by a period.
qualident ::= qualident . <identifier> ::= <identifier> |
Modula-2 also has a number of standard identifiers. These are automatically imported, and, though not being reserved words, should not be redeclared.
Contents | Prev | Next | Index
Canterbury Modula-2 for Java (Last documentation update
Feb 8, 2000)
Copyright © 1998 Mill Hill &
Canterbury Corporation, Ltd. All rights reserved
Please send any comments or corrections to
mhc@webcom.com