Re: Declaring Units in the 'Uses' section



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
.



Relevant Pages

  • Re: Design documents versus prototypes
    ... Then I got a bollocking for not producing design documents so that the ... I had taken the requirements document and used the RAD power of Delphi ... I said, this is an heterogenous system, and when I built the prototype, ...
    (borland.public.delphi.non-technical)
  • Re: Delphi to C#?
    ... you can design easy to maintain, ... Not all apps need a fully-fledged business object model. ... I never spent the time figuring out if this was even possible in Delphi, ...
    (borland.public.delphi.non-technical)
  • Re: Slow and ugly Java GUIs are programmers fault
    ... >>It seems to me that most Java IDE that currently exist are focused ... > on par with what little I tried Delphi. ... Well, if you're satisfied with JBuilder, that's fine with me. ... An example is the fact that all the GUI design in JBuilder is stored as ...
    (comp.lang.java.gui)
  • Re: I really hate .NET especially inside Delphi
    ... but imagine what would have happened if Delphi was simply ... Can't break backward compatibility with my ... deployment vs. code design is irrelevant. ...
    (borland.public.delphi.non-technical)
  • Re: Delphi to C#?
    ... WinForms allows binding of controls directly to properties of objects, something that Delphi cannot yet cope with; in fact, .NET allows controls to be the datasource for other controls. ... There is a whole different design ethic behind .NET compared to Win32; most importantly that *everything* in .NEt is essentially an object whereas in Delphi for Win32 methods it is not yet possible to have every type assignable to a common type of variable/field like System.Object, thus providing useful common methods like ToString. ...
    (borland.public.delphi.non-technical)