comp.lang.ada
 help / color / mirror / Atom feed
From: Jeff Carter <jrcarter010@earthlink.net>
Subject: Re: Elaboration circularity
Date: 2000/02/02
Date: 2000-02-02T00:00:00+00:00	[thread overview]
Message-ID: <389858D0.32A39FFC@earthlink.net> (raw)
In-Reply-To: 949502026.152029@edh3

I've encountered similar problems with legacy code. I eliminated the
circularity using a child package. I don't know if it will work for you,
but here's how it worked for me:

There are 2 packages, A and B. The spec of A has some type declarations
and some operations. The spec of B has "with A;" and references the type
declarations in A. The body of B also references the type declarations
in A. The body of A has "with B;", "pragma Elaborate (B);" (this was
Ada-83 legacy code), and calls the operations of B during elaboration.
Thus B has to be elaborated before A. Hence the circularity: The body of
each package depends on the spec of the other.

I moved the operations of A, including the elaboration that calls B,
into a child package, A.Operations. This allows B to "with A;" and the
body of A.Operations to "with B;" without a circularity. The unit which
called the operations in A had to also be modified to "with
A.Operations;".

HTH.

-- 
Jeff Carter
"You empty-headed animal-food-trough wiper."
Monty Python & the Holy Grail




  reply	other threads:[~2000-02-02  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-02  0:00 Elaboration circularity Frode Tenneboe
2000-02-02  0:00 ` Jeff Carter [this message]
2000-02-05  0:00   ` Robert Dewar
2000-02-07  0:00     ` Frode Tenneboe
2000-02-07  0:00       ` Larry Kilgallen
2000-02-07  0:00       ` Robert Dewar
2000-02-02  0:00 ` Matthew Heaney
replies disabled

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