Contents | Prev | Next | Index
As in its predecessors Pascal and Modula-2, Oberon-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 declared in a module block (see modules) may be followed by an export mark in its declaration. This indicates that is is exported. The export mark is an asterisk or a minus sign. An identifier x exported by a module M may be used in other modules if they import M (see imports). The identifier is then designated as M.x in these modules and is a qualified identifier. Identifiers marked with a minus in their declaration are read-only in importing modules.
qualident ::= qualident . <identifier> ::= <identifier> identdef ::= <identifier> ::= <identifier> * ::= <identifier> - |
Oberon-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 Oberon-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