next up previous contents
Next: USE ONLY Statement Up: Modules Previous: Encapsulation - Stack example

 

The USE Renames Facility

 

The USE statement names a module whose public definitions are to be made accessible. It has the following form:

 
USE < module-name > [,< new-name > => < use-name >...]

If a local entity has the same name as an object in the module, then the module object can be renamed, (as many renames as desired can be made in one USE statement, they are just supplied as a comma separated list),

    USE Stack, IntegerPop => Pop

Here the module object Pop is renamed to IntegerPop when used locally. This renaming facility is essential otherwise user programs would often require rewriting due to name clashes, in this way the renaming can be done by the compiler. Renaming should not be used unless absolutely necessary as it can add a certain amount of confusion to the program. It is only permissible to rename an object once in a particular scoping unit.

Return to corresponding overview page gif


next up previous contents
Next: USE ONLY Statement Up: Modules Previous: Encapsulation - Stack example

©University of Liverpool, 1997
Wed May 28 20:20:27 BST 1997
Not for commercial use.