Delphi Language Guide Delphi for Microsoft Win32 Delphi for the Microsoft. Net framework



Yüklə 0,84 Mb.
Pdf görüntüsü
səhifə31/294
tarix02.01.2022
ölçüsü0,84 Mb.
#41395
1   ...   27   28   29   30   31   32   33   34   ...   294
DelphiLanguageGuide

Circular Unit References
When units reference each other directly or indirectly, the units are said to be mutually dependent. Mutual
dependencies are allowed as long as there are no circular paths connecting the uses clause of one interface section
to the uses clause of another. In other words, starting from the interface section of a unit, it must never be possible
to return to that unit by following references through interface sections of other units. For a pattern of mutual
dependencies to be valid, each circular reference path must lead through the uses clause of at least one
implementation section.
In the simplest case of two mutually dependent units, this means that the units cannot list each other in their interface
uses clauses. So the following example leads to a compilation error:
unit Unit1;
interface
uses Unit2;
// ...
unit Unit2;
interface
18


uses Unit1;
// ...
However, the two units can legally reference each other if one of the references is moved to the implementation
section:
unit Unit1;
interface
uses Unit2;
// ...
unit Unit2;
interface
//...
implementation
uses Unit1;
// ...
To reduce the chance of circular references, it's a good idea to list units in the implementation uses clause whenever
possible. Only when identifiers from another unit are used in the interface section is it necessary to list that unit in
the interface uses clause.
19



Yüklə 0,84 Mb.

Dostları ilə paylaş:
1   ...   27   28   29   30   31   32   33   34   ...   294




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©www.azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin