comp.lang.ada
 help / color / mirror / Atom feed
From: "Samuel T. Harris" <sam_harris@hso.link.com>
Subject: Re: Package with initialization only
Date: 1999/07/22
Date: 1999-07-22T00:00:00+00:00	[thread overview]
Message-ID: <37977F3A.8D91C2AF@hso.link.com> (raw)
In-Reply-To: 7n65nl$1ru2@svlss.lmms.lmco.com

David Kristola wrote:
> 
> "Samuel T. Harris" <sam_harris@hso.link.com> () writes:
> >Ted Dennison wrote:
> >>
> >> In article <37961DD6.E56BD3E9@maths.unine.ch>,
> >>   Gautier <gautier.demontmollin@maths.unine.ch> wrote:
> >> > A small "aesthetic" problem: I have a package with initialization
> >> only;
> >> > thus I must add a dummy procedure to resolve the with/without body
> >> > ambiguity Ada95 doesn't accept. There is surely a more elegant
> >> formulation,
> >>
> >> Well, perhaps it would be more pleasing if you renamed your dummy
> >> routine "Initialize" and moved all the initialization code into it. If
> >> you put it into the public part that would even allow others to
> >> reinitialize the variable.
> >>
> >
> >While I don't disagree with Ted's suggestion,
> >I do want to point out that many times the
> >"intialization" must be done only once, preferably
> >during elaboration. In such cases, I call the
> >procedure "elaborate" and call it in the package body.
> >I feel the name elaborate conveys the restriction
> >of single initialization
> 
> Maybe it is my real-time embedded systems background,
> but i much prefer explicit initialization over
> elaboration.  The example that immediately comes to
> mind is a case where the elaboration code wrote over
> a memory mapped bus and sometimes caused contention
> interrupts.  There was a handler to deal with the
> situation, but it was not installed yet.
> Installation of interrupt handlers was the first
> thing the main program did after elaboration.
> 

This post and the two that follow reinforce my point.
To me, initialization may or may not occur more than
one, but elaboration can ONLY occur once. Whether or
not the elaborate procedure is called in the package
body, or deferred to the main program is an architectural
consideration. In a simulator being produced here,
what would normally be elaborate code cannot be done
until the controlling tasks are running to schedule
the work. So these "elaboration" routine are distinct
from other "initialize" routines and are part of
the architectural framework.

I'm not sure if Dave meant to disagree or support me.
My elaborate routine is explicit initialization.
Architectural considerations determine where it is
called. I use the procedure name elaborate to
distinguish once-only intialization which must
occur early on in the running program before
stuff in its package is actually used with _normal_
initialization which may or may occur many times
but needs be done before accessing a particular
feature or variable.

-- 
Samuel T. Harris, Principal Engineer
Raytheon, Scientific and Technical Systems
"If you can make it, We can fake it!"




  parent reply	other threads:[~1999-07-22  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-21  0:00 Package with initialization only Gautier
1999-07-21  0:00 ` Gautier de Montmollin
1999-07-21  0:00 ` Ted Dennison
1999-07-21  0:00   ` Samuel T. Harris
1999-07-21  0:00     ` David C. Hoos, Sr.
1999-07-22  0:00     ` David Kristola
1999-07-22  0:00       ` Ted Dennison
1999-07-22  0:00       ` Samuel T. Harris [this message]
1999-07-22  0:00       ` Marin David Condic
1999-07-22  0:00         ` laoxhai
1999-07-21  0:00 ` Martin C. Carlisle
1999-07-21  0:00 ` Robert A Duff
1999-07-22  0:00 ` Robert I. Eachus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox