Re: Declaring Units in the 'Uses' section
- From: erewhon@xxxxxxxxxx (J French)
- Date: Sun, 14 Aug 2005 13:08:48 +0000 (UTC)
On Sun, 14 Aug 2005 11:45:05 GMT, "DAVID B MORGAN"
<lepton2deletethis@xxxxxxxxxxx> wrote:
>When developing a program several units are included by default in the
>"Uses" section (SysUtils,Varients,etc...). Other units
>are automatically added to that list by Delphi itself as the project is
>built and they become required. My question is: why did Borland
>decide to make it neccessary to manually add certain units even though they
>come standard with Delphi and all exist in the same directory? The "Math"
>unit and the "Sysutils" unit both exist in my "C:\Program
>Files\Borland\Delphi6\Lib" directory yet when I wish to use a fuction from
>the "Math" unit like the "CompareValue" function I must actually type the
>word "Math" in the USES section.
>I know that there must be a reason for this. Can anyone tell me why it is
>done this way? Are other languages the same? Is this something
>a "preproccesser" takes care of in "C"?
It is (I believe) how Pascal works - or rather is designed
- the automatically added stuff is needed for pick'n'place or
'automatic' templates like Forms
In my D4P is I add a new Unit then it does not even make a Uses clause
- although System.pas is implicitly there
There is a lot of sense in this approach as it makes the programmer
totally responsible for controlling Scope
eg: determining what the Unit can 'see'
If a preprocessor scampered through the code looking for procedures
and guessing what Unit to add to the Uses clause, then it could land
up adding the wrong Unit
At first it is irritating, but when one goes back to 'old code' it is
a real joy to be able to see at a glance what a Unit knows about and
what it exposes to other units.
I suggest that you roll with it, rather than fight it
- the design is actually quite useful
.
- References:
- Declaring Units in the 'Uses' section
- From: DAVID B MORGAN
- Declaring Units in the 'Uses' section
- Prev by Date: Re: Declaring Units in the 'Uses' section
- Next by Date: Re: Declaring Units in the 'Uses' section
- Previous by thread: Re: Declaring Units in the 'Uses' section
- Next by thread: Re: Declaring Units in the 'Uses' section
- Index(es):
Relevant Pages
|