[prev] [prev-tail] [tail] [up]

#### 16.5.4 Unit scope

All identifiers in the interface part of a unit are valid from the point of declaration, until the end of the unit. Furthermore, the identifiers are known in programs or units that have the unit in their uses clause.

Identifiers from indirectly dependent units are not available. Identifiers 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. Its identifiers are therefore always known, in each Pascal program, library or unit.

The rules of unit scope imply that an identifier of a unit can be redefined. To have access to an identifier 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 identifiers.

[prev] [prev-tail] [front] [up]