next up previous contents
Next: Intrinsics Up: Modules Previous: The USE Renames Facility

 

USE ONLY Statement

It is possible to restrict the availability of objects declared in a module made visible use association by using the ONLY clause of the USE statement. In this way name clashes can be avoided by only using those objects which are necessary. It has the following form:

 
USE  tex2html_wrap_inline21746  module-name  tex2html_wrap_inline21748  [ ONLY: tex2html_wrap_inline21746  only-list  tex2html_wrap_inline21748 ...]

The tex2html_wrap_inline21746  only-list tex2html_wrap_inline21748 can also contain renames (=>).

This method can be used as an alternative to renaming module entities, for example, a situation may arise where a user wishes to use 1 or 2 objects from a module but discovers that if the module is accessed by use association there are a couple of hundred name clashes. The simplest solution to this is to only allow the 1 or 2 objects to be seen by his / her program. These 1 or 2 objects can be renamed if desired.

For example,

    USE HOUSE_DEF, ONLY:HOME => HOUSE, GET_HOME => GET_HOUSE
Only HOME and GET_HOME are made accessible and these are both renamed.

The USE statement, with its renaming and restrictive access facilities, gives great user control enabling two modules with similar names to be accessed by the same program with only minor inconvenience. In addition, the ONLY clause gives the compiler the option of just including the object code associated with the entities specified instead of the code for the whole module. This has the potential to make the executable code smaller and faster.


next up previous contents
Next: Intrinsics Up: Modules Previous: The USE Renames Facility

Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 15:03:35 GMT 1996
Not for commercial use.