next up previous contents index
Next: Reserved Words Up: Symbolic Names Previous: Symbolic Names

Scope of Symbolic Names

  Symbolic names which identify common blocks and program units of all types are global in scope, i.e. their name must be unique in the entire executable program. Names identifying all other items (variables, arrays, constants, statement functions, intrinsic functions, and all types of dummy argument) are local to the program unit in which they are used so that the same name may be used independently in other program units.

To see the effect of these rules here is a simple example. Suppose your program contains a subroutine called SUMMIT. This is a global name so it cannot be used as the name of global item (such as an external procedure or a common block) in the same executable program. In the SUMMIT subroutine and in any other program unit which calls it the name cannot be used for a local item such as a variable or array. In all other program units, however, including those which call SUMMIT indirectly, the name SUMMIT can be used freely e.g. for a constant, variable, or array.

The names of global   items need to be chosen more carefully because it is harder to alter them at a later stage; it can be difficult to avoid name clashes when writing a large program or building a library of procedures unless program unit names are allocated systematically. It seems appropriate for procedures to have names which are verb-like. If you find it difficult to devise sensible procedure names remember that the English language is well stocked with three and four-letter verbs which form a good basis, for example: DO, ASK, GET, PUT, TRY, EDIT, FORM, LIST, LOAD, SAVE, PLOT. By combining a word like one of these with one or two additional letters it is possible to make up a whole range of procedure names.


next up previous contents index
Next: Reserved Words Up: Symbolic Names Previous: Symbolic Names
Helen Rowlands
8/27/1998