comp.lang.ada
 help / color / mirror / Atom feed
From: ncohen@watson.ibm.com (Norman H. Cohen)
Subject: Re: cross linking packages
Date: 29 Nov 1994 18:28:47 GMT
Date: 1994-11-29T18:28:47+00:00	[thread overview]
Message-ID: <3bfrsv$1e2o@watnews1.watson.ibm.com> (raw)
In-Reply-To: CzzAMz.K9F@inter.NL.net

In article <CzzAMz.K9F@inter.NL.net>, rburema@inter.NL.net (Rene Burema)
writes: 

|> I have a problem specifing a seemingly simple problem in Ada. Anybody
|> want to help?
|>
|> The problem is as follows: 
|>
|> -------------------- package A -----------------------
|> package A;
|> type tA is private;
|> procedure giveB(x: in tA,y: out tB);
|> end A;
|> -------------------- package B -----------------------
|> package B;
|> type tB is private;
|> procedure giveA(x: in tB,y: out tA);
|> end B;
|> ---------------
|> where tA could be a reference to a  Doctor giving the reference to
|> a Patient (tB) and vice versa.
|>
|> I need a with statement for B and A respectively. The Ada gnat compiler
|> however stumbles into a circular dependency. How can I solve this without
|> placing the two types tA and tB in a single package.

package Parents is
   type tA_Parent is abstract tagged null record;
   type tB_Parent is abstract tagged null record;
end Parents;

with Parents;
package A is
   type tA is new tA_Parent with private;
   procedure giveB(x: in tA_Parent'Class; y: out tB_Parent'Class);
private
   type tA is new tA_Parent with ...;
end A;

with Parents;
package B is
   type tB is new tB_Parent with private;
   procedure giveA (x: in tB_Parent'Class; y: out tA_Parent'Class);
private
   type tB is new tB_Parent with ...;
end B;

--
Norman H. Cohen    ncohen@watson.ibm.com



  reply	other threads:[~1994-11-29 18:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-11-28 12:56 cross linking packages Rene Burema
1994-11-29 18:28 ` Norman H. Cohen [this message]
1994-11-29 22:07 ` Robert Dewar
1994-11-30 16:33   ` David Weller
1994-12-01 13:44     ` Robert I. Eachus
1994-11-30 23:03   ` Matt Kennel
1994-12-02 14:30     ` Norman H. Cohen
1994-12-05 20:57     ` Elaboration order [was: cross linking packages] John Volan
1994-12-06 16:11       ` Robert Dewar
1994-12-05 13:30 ` cross linking packages John Volan
  -- strict thread matches above, loose matches on Subject: below --
1994-12-06 16:34 Bob Wells #402
replies disabled

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