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.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,93fa00d728cc528e X-Google-Attributes: gid103376,public X-Google-Thread: 1108a1,93fa00d728cc528e X-Google-Attributes: gid1108a1,public X-Google-ArrivalTime: 1994-10-21 09:45:29 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!library.ucla.edu!delphi.cs.ucla.edu!not-for-mail From: jmartin@oahu.cs.ucla.edu (Jay Martin) Newsgroups: comp.lang.ada,comp.object Subject: Re: SOLVED! Decoupled Mutual Recursion Challenger Date: 18 Oct 1994 21:45:47 -0700 Organization: UCLA Computer Science Dept. Message-ID: <38289r$79m@oahu.cs.ucla.edu> References: <1994Oct12.224944.25566@swlvx2.msd.ray.com> <1994Oct17.205244.17450@swlvx2.msd.ray.com> <1994Oct18.221751.15457@swlvx2.msd.ray.com> NNTP-Posting-Host: oahu.cs.ucla.edu Keywords: Ada9X, "withing" problem, CORBA, IDL X-Newsreader: NN version 6.5.0.b3.0 #8 (NOV) Xref: bga.com comp.lang.ada:7151 comp.object:7641 Date: 1994-10-18T21:45:47-07:00 List-Id: With all these ugly workarounds it looks like we must have a language extension to Ada to handle mutual dependencies. Otherwise Ada9x is a "joke". Of course if there is no way that Ada will be extended quickly, it will be a "joke" anyway. Hopefully C++ has taught language designers/standardizers something. The extension would be of the form: package forward X is type XType; type XPtrType is access XType; end X; And would be severely resticted to only allow for incomplete types declaration and access types to incomplete types. These of course would have to be repeated/elaborated in the package spec. Thus, there would be a third package part in Ada compilation libraries (Spec and body being the other two). What it does is tells the Ada compiler to not give an error if these yet to be specified types are used in a spec. So basically a programmer could compile the forwards first, then the specs and finally the bodies into the Ada library. (GNAT looney tunes "#include the spec" implementation of the Ada library would place all the withed package's forwards before their specs when compiling.) Of course, you couldn't directly declare incomplete objects in the private parts of specs. An elegant way of handling this (which would be too obese to put in ada) would be to have a separately compiled "package representation" part of a package which would basically remove the private part of spec out of the spec. For example: with X; package representation Y is type YType is record P1:integer; P2:X.XType; end record; end X; Its neat because it removes implementation details from the spec where they never belonged and allows for mutually recursive types to be directly included into the abstract data type (instead of having a pointer to it). Jay