From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7a4380ff535aa24d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-11-29 17:10:23 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!gatech!rutgers!goclenius.rutgers.edu!dziuxsolim.rutgers.edu!uunet!newsgate.watson.ibm.com!watnews.watson.ibm.com!ncohen From: ncohen@watson.ibm.com (Norman H. Cohen) Newsgroups: comp.lang.ada Subject: Re: cross linking packages Date: 29 Nov 1994 18:28:47 GMT Organization: IBM T.J. Watson Research Center Distribution: world Message-ID: <3bfrsv$1e2o@watnews1.watson.ibm.com> References: Reply-To: ncohen@watson.ibm.com NNTP-Posting-Host: rios8.watson.ibm.com Date: 1994-11-29T18:28:47+00:00 List-Id: In article , 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