BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Newbie question: why 2 uses clauses?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.misc
View previous topic :: View next topic  
Author Message
swansnow
Guest





PostPosted: Tue Sep 20, 2005 4:10 pm    Post subject: Newbie question: why 2 uses clauses? Reply with 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

Back to top
Andreas Koch
Guest





PostPosted: Tue Sep 20, 2005 4:37 pm    Post subject: Re: Newbie question: why 2 uses clauses? Reply with quote



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





PostPosted: Tue Sep 20, 2005 7:00 pm    Post subject: Re: Newbie question: why 2 uses clauses? Reply with quote




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





PostPosted: Wed Sep 21, 2005 4:32 pm    Post subject: Re: Newbie question: why 2 uses clauses? Reply with quote

Cool! Thanks a lot, Alan. This is really helpful!

Back to top
Marco van de Voort
Guest





PostPosted: Fri Sep 30, 2005 3:54 pm    Post subject: Re: Newbie question: why 2 uses clauses? Reply with quote

;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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.misc All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.