comp.lang.ada
 help / color / mirror / Atom feed
From: jmartin@oahu.cs.ucla.edu (Jay Martin)
Subject: Re: SOLVED! Decoupled Mutual Recursion Challenger
Date: 18 Oct 1994 21:45:47 -0700
Date: 1994-10-18T21:45:47-07:00	[thread overview]
Message-ID: <38289r$79m@oahu.cs.ucla.edu> (raw)
In-Reply-To: CxwAuy.1CL@inmet.camb.inmet.com

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













  reply	other threads:[~1994-10-19  4:45 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-10-12 22:49 SOLVED! Decoupled Mutual Recursion Challenger John Volan
1994-10-17 15:48 ` John Volan
1994-10-17 17:55   ` Bob Duff
1994-10-17 20:52     ` John Volan
1994-10-17 22:10       ` Bob Duff
1994-10-18 22:17         ` John Volan
1994-10-19  1:01           ` Bob Duff
1994-10-19  4:45             ` Jay Martin [this message]
1994-10-19 14:38               ` Mark A Biggar
     [not found]                 ` <38fi4r$l81@oahu.cs.ucla.edu>
1994-10-24 11:49                   ` Mutual Recursion Challenge Robert I. Eachus
1994-10-24 20:32                     ` John Volan
1994-10-26 11:42                       ` Generic association example (was Re: Mutual Recursion Challenge) Robert I. Eachus
1994-10-26 23:21                         ` John Volan
1994-10-27 10:53                           ` Robert I. Eachus
1994-10-31 17:34                             ` John Volan
1994-10-27 14:37                           ` Mark A Biggar
1994-10-24 17:42                   ` SOLVED! Decoupled Mutual Recursion Challenger John Volan
1994-10-24 22:37                     ` Jay Martin
1994-10-25  5:47                       ` Matt Kennel
1994-10-25 10:04                         ` David Emery
1994-10-25 16:43                         ` John Volan
1994-10-27  4:25                           ` Rob Heyes
1994-10-28  9:03                             ` Mutual Recursion (was Re: SOLVED! Decoupled Mutual Recursion Challenger) Robert I. Eachus
1994-10-28 15:04                             ` SOLVED! Decoupled Mutual Recursion Challenger Robb Nebbe
1994-10-25 15:54                       ` John Volan
1994-10-26  1:24                         ` Bob Duff
1994-10-28  4:28                         ` Jay Martin
1994-10-28 10:52                           ` Robert I. Eachus
1994-10-28 18:46                             ` Jay Martin
1994-11-02 14:56                               ` Robert I. Eachus
1994-10-29  0:38                           ` Bob Duff
1994-10-29  7:26                             ` Jay Martin
1994-10-29 11:59                             ` Richard Kenner
1994-10-31 13:17                               ` Robert Dewar
1994-10-31 14:13                               ` gcc distribution (was: SOLVED! Decoupled Mutual Recursion Challenger) Norman H. Cohen
1994-11-02 14:14                                 ` Richard Kenner
1994-11-04 23:56                                   ` Michael Feldman
1994-10-31 18:44                           ` SOLVED! Decoupled Mutual Recursion Challenger John Volan
1994-10-20 11:25               ` Robb Nebbe
1994-10-20 19:19                 ` John Volan
1994-10-26  0:07                 ` Mark S. Hathaway
1994-10-26 18:48                 ` gamache
1994-10-27  2:15                   ` John Volan
     [not found]           ` <CxwGJF.FwB@ois.com>
1994-10-19 16:35             ` John Volan
1994-10-17 22:54   ` Cyrille Comar
replies disabled

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