Named Integers in Component Pascal.

Details:

Here you found an implementation of named integers for Component Pascal without changing the original compiler. The benefit of named integers is self-documentation. Named integers are eliminating the need to explicitly assign constants to symbols. It makes the declarations simpler and more clear. It also reduces the likelihood of the programmer accidentally assigning the same constant to two symbols.

In general

TYPE Color* = (red, blue, green);

is defined to be _exactly_ equivalent to

TYPE Color* = INTEGER; CONST red* = 0; blue* = 1; green* = 2;

Named integers have none of the implementation problems of enumerated types. They are simply a syntactic sugar that provide an immense benefit of self-documentation for a very small price. They do not introduce a new type. Named integers are integers.

Author: Stan Warford and Helmut Zinn

Published by: Anton Shelin