Go to the first, previous, next, last section, table of contents.


The scope operators :: and .

There are a few subtle differences between the Modula-2 scope operator (.) and the scope operator (::). The two have similar syntax:


module . id
scope :: id

where scope is the name of a module or a procedure, module the name of a module, and id is any declared identifier within your program, except another module.

Using the :: operator makes search the scope specified by scope for the identifier id. If it is not found in the specified scope, then searches all scopes enclosing the one specified by scope.

Using the . operator makes search the current scope for the identifier specified by id that was imported from the definition module specified by module. With this operator, it is an error if the identifier id was not imported from definition module module, or if id is not an identifier in module.


Go to the first, previous, next, last section, table of contents.