[DUG] Usage - initialization and finalization
Kyley Harris
kyley at harrissoftware.com
Mon May 22 18:28:23 NZST 2006
Sorry if you felt I was patronizing you, but why would I waste my energy
doing that to anyone. If patronizing was my goal, I just wouldn't reply
to a post... That's patronizing.
It was a serious question. And now that you link to a post you were
referring to, that you didn't link to before, I have my answer don't I?
I would say that Peter is wrong. You can determine what is implemented
first through analysis. The level of difficulty of doing so is really
dependant on the skill of the person looking at the code. His comments
regarding implemetaion Uses clauses is tripe.
If you could impose order, which you can by cheating, then it would
defeat the purpose of initialization which is "to prepare a unit of code
for use before any other unit requiring that unit is initialized"
If unita reffered to unitb in implementation, and unitb also did the
same, then somewhere in the project something must refer to either unita
or unitb, causing the correct initialization phase.
-----Original Message-----
From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz]
On Behalf Of Karl @ Work
Sent: Monday, 22 May 2006 5:33 p.m.
To: 'NZ Borland Developers Group - Delphi List'
Subject: RE: [DUG] Usage - initialization and finalization
> There is no such thing as a circular reference in Delphi. IE. The
> compiler will come up with a compiler error.
>
> What you are referring to is where one unit references another in this
> fashion.
>
> Unit UnitA
>
> Interface
> Uses UnitB
>
> Unit UnitB
>
> Implementation
> Uses
> UnitA;
>
>
> Initialization and finalization are part of the private implementation
> of a unit. Not a public part of a unit. No code in unitA interface has
> any relevance to an initialization, because there is no executing
> code.....
> UnitB is clearly saying that its executing portion requires
> information
> from UnitA. Initializations must execute in dependency order.
>
> So. What do you think the order will be?
No, please, do try to be a little more patronising why don't you? I was
referring to a circular reference between the uses clauses of units in
their respective *implementation* sections. In the words of Peter
Below,
>>
You can rely on any unit in the Interface Uses clause of unit A to be
initialized
before unit A is initialized. There is no such guarantee for units named
in the
Implementation Uses clause.
<<
http://groups.google.co.nz/group/borland.public.delphi.language.delphi.g
eneral/browse_frm/thread/7ee41b0debff7380/46e112c1bc57e2c5
Sure, you can log the order that your unit initializations and
finalizations are firing in easily enough. But to be able to impose an
order is another task entirely.
Cheers,
Carl
More information about the Delphi
mailing list