comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@gnat.com
Subject: Re: Design Question: How Best To Structure Cross-Referencing Types In Ada 95
Date: 1999/01/21
Date: 1999-01-21T00:00:00+00:00	[thread overview]
Message-ID: <787fku$k4m$1@nnrp1.dejanews.com> (raw)
In-Reply-To: 36A68FCA.E1EEAFFE@hiwaay.net

In article <36A68FCA.E1EEAFFE@hiwaay.net>,
  aeg@hiwaay.net, glover@thaad.tecmasters.com wrote:
> This is a multi-part message in MIME format.
> --------------6448902F32C077DF069276B5
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
> Since both types and some of the subprograms reference
> each other, I have to put them both in the same package.
> It turns out that I have about 5 types that
> behave like this and I end up with one large package.  I
> would rather have the types split into different
> packages, but I would get circular dependencies when
> compiling the specs.
>
> Is there a neat Ada95 way of getting around this
> cross-referencing problem?

This is an old and well discussed problem. Often you can
introduce a third package with the types alone to at least
factor this out, but the fundamental circularity problem
remains and there is no solution in pure Ada 95.

For JGNAT, the version of GNAT that generates code for the
JVM, we have found it important to deal with this problem
for the purpose of translating existing Java specs. We have
therefore implemented an extension, based on Tucker's "with
type" suggestion the last time around this was discussed,
and this extension will be available (controlled by a
switch of course) in version 3.12 of GNAT.

There are not many places where one can justify out and out
extensions of the language (and indeed I suppose one could
do this with a pragma, but it seems silly). This however,
seems an exception, where an extension is really needed.

Robert Dewar
Ada Core Technologies


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




  reply	other threads:[~1999-01-21  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-20  0:00 Design Question: How Best To Structure Cross-Referencing Types In Ada 95 Anthony E. Glover
1999-01-21  0:00 ` dewar [this message]
1999-01-21  0:00   ` Brian Rogoff
1999-01-26  0:00   ` Dale Stanbrough
1999-01-21  0:00 ` Matthew Heaney
1999-01-30  0:00   ` Nick Roberts
1999-01-31  0:00     ` Matthew Heaney
1999-01-21  0:00 ` dennison
1999-01-22  0:00 ` Steve Whalen
1999-01-22  0:00   ` dennison
replies disabled

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