 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
swansnow Guest
|
Posted: Tue Sep 20, 2005 4:10 pm Post subject: Newbie question: why 2 uses clauses? |
|
|
Some things, the help doesn't seem very clear on...
What goes in the uses clause in the interface section, and what goes in
the implementation section?
-Corinna
|
|
| Back to top |
|
 |
Andreas Koch Guest
|
Posted: Tue Sep 20, 2005 4:37 pm Post subject: Re: Newbie question: why 2 uses clauses? |
|
|
swansnow wrote:
| Quote: | Some things, the help doesn't seem very clear on...
What goes in the uses clause in the interface section, and what goes in
the implementation section?
|
Try to put as much as possible in the implementation section - this
will reduce dependancy problems. As much as possible = everything
you still get compiled.
Put the rest (and what the IDE generates for you) in the interface section.
|
|
| Back to top |
|
 |
alanglloyd@aol.com Guest
|
Posted: Tue Sep 20, 2005 7:00 pm Post subject: Re: Newbie question: why 2 uses clauses? |
|
|
swansnow wrote:
| Quote: | Some things, the help doesn't seem very clear on...
What goes in the uses clause in the interface section, and what goes in
the implementation section?
-Corinna
|
There are four possible sections in your unit, some of them are
automatically entered by the IDE, some you have to enter ...
1 interface
This is "seen" and accessible by any unit quoting your unit in its uses
section (having quoted it in either its interface / uses or its
implementation / uses). It is (surprise, surprise) the interface to
your unit.
2 implementation
The contents of this section are "seen" and accessed only by code in
your unit, subject to non-methods being declared before they are
referenced. This section can contain uses, var, const, or type sections
which you must enter (just as in the interface section). You should
normally put a reference to any units you write in this section.
However if you use something in the interface section which has been
declared in another unit, then that unit must be declared in the
interface section / uses section and not in the iomplementation / uses
section. Note that var and type clauses can be redeclared throughout
the unit if you wish so that those declarations can be visually
associated with the methods which use them. Sensible use of the
implementation / uses clause prevents "circular references error",
where UnitA references UnitB which references UnitA.
3 initialization
This section contains initialisation code of which all initialisation
code in all units is run before the code in any implementation section.
The initialisation code is run in the order in which your code
encaounter the various units in the uses clause of all units. Yu must
enter the "initialization" keyword.
4 finalization
This section contain code which is run at the close of the programs in
the reverse order to which your application runs the initialization
codes. You must enter the "finalization" keyword.
Alan Lloyd
|
|
| Back to top |
|
 |
swansnow Guest
|
Posted: Wed Sep 21, 2005 4:32 pm Post subject: Re: Newbie question: why 2 uses clauses? |
|
|
Cool! Thanks a lot, Alan. This is really helpful!
|
|
| Back to top |
|
 |
Marco van de Voort Guest
|
Posted: Fri Sep 30, 2005 3:54 pm Post subject: Re: Newbie question: why 2 uses clauses? |
|
|
;5B> implementation / uses clause prevents "circular references error",
| Quote: | where UnitA references UnitB which references UnitA.
3 initialization
This section contains initialisation code of which all initialisation
code in all units is run before the code in any implementation section.
The initialisation code is run in the order in which your code
encaounter the various units in the uses clause of all units. Yu must
enter the "initialization" keyword.
|
3A old TP style begin..end initialization. Essentially the same as
initialization but with different syntax.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|