All identi ers in the interface part of a unit are valid from the point of declaration, until the end of the unit. Furthermore, the identi ers are known in programs or units that have the unit in their uses clause. Identi ers from indirectly dependent units are not available. Identi ers declared in the implementation part of a unit are valid from the point of declaration to the end of the unit. The system unit is automatically used in all units and programs. It's identi ers are therefore always known, in each pascal program, library or unit. The rules of unit scope imply that an identi er of a unit can be rede ned. To have access to an identi er of another unit that was redeclared in the current unit, precede it with that other units name, as in the following example:
unit unitA;
interface Type MyType = Real; implementation end. Program prog; Uses UnitA; { Redeclaration of MyType} Type MyType = Integer; Var A : Mytype; { Will be Integer } B : UnitA.MyType { Will be real } begin end. |
This is especially useful when redeclaring the system unit's identi ers.