comp.lang.ada
 help / color / mirror / Atom feed
From: beckwb@ois.com (R. William Beckwith)
Subject: Re: Mut. Recurs. in Ada9X w/o Breaking Encaps.? (LONG)
Date: Tue, 4 Oct 1994 02:12:16 GMT
Date: 1994-10-04T02:12:16+00:00	[thread overview]
Message-ID: <Cx4M4G.Ir1@ois.com> (raw)
In-Reply-To: EACHUS.94Oct3121410@spectre.mitre.org

O.K., I guess I've been watching on the side lines too long :-).

I addressed the issue of mutual recursion (I called it the `withing'
problem) with Tuck early in our efforts to map CORBA IDL to Ada 9X.

Since then, we have solved the problem.  I have said to several people
that you may want to use a CORBA IDL to Ada translator even for
non-distributed systems.  Now is my chance to put up or shut up.

In C++ you can have mutual recursion:

    // file chicken.h

    #ifndef CHICKEN
    #define CHICKEN

    class Chicken;

    #include "egg.h"

    class Chicken {
	public:
	    Egg lay();
    };

    #endif


    // file egg.h

    #ifndef EGG
    #define EGG

    class Egg;

    #include "chicken.h"

    class Egg {
	public:
	    Chicken hatch();
    };

    #endif

In CORBA IDL you can have mutual recursion:

    // file chicken.idl

    #ifndef CHICKEN
    #define CHICKEN

    interface Chicken;

    #include <egg_file.idl>

    interface Chicken {
	Egg lay();
    };

    #endif


    // file egg.idl

    #ifndef EGG
    #define EGG

    interface Egg;

    #include <chicken_file.idl>

    interface Egg {
	Chicken hatch();
    };

    #endif

In Ada 9X you can have mutual recursion:

    (result of IDL to Ada 9X translator with simplifications)

    with Ada.Finalization;

    package Corba is

	type Object is tagged ...

	type Ref is tagged ...

    end Corba;

    -------------------------------------------------

    with Corba;

    package chicken_file is

	type Chicken_Ref is new Corba.Ref with null record;

    end chicken_file;

    -------------------------------------------------

    with Corba;
    with egg_file;

    package chicken_file.Chicken is

	type Ref is new Chicken_Ref with null record;

	function lay
		(Self : Ref)
	    return egg_file.Egg_Ref'Class;
	    -- returns a egg_file.Egg.Ref

    end chicken_file.Chicken;

    -------------------------------------------------

    with Corba;
    with egg_file.Egg;

    package chicken_file.Chicken.Impl is

	type Object is new Corba.Object with
	    record
		-- (implementation data)
	    end record;

	function lay
		(Self : in Object)
	    return Egg.Ref'Class;

    end chicken_file.Chicken.Impl;

    -------------------------------------------------

    with Corba;

    package egg_file is

	type Egg_Ref is new Corba.Ref with null record;

    end egg_file;

    -------------------------------------------------

    with Corba;
    with chicken_file;

    package egg_file.Egg is

	type Ref is new Egg_Ref with null record;

	function hatch
		(Self : Ref)
	    return chicken_file.Chicken_Ref'Class;
	    -- returns a chicken_file.Chicken.Ref

    end egg_file.Egg;

    -------------------------------------------------

    with Corba;
    with chicken_file.Chicken;

    package egg_file.Egg.Impl is

	type Object is new Corba.Object with
	    record
		-- (implementation data)
	    end record;

	function hatch
		(Self : in Object)
	    return Chicken.Ref'Class;

    end egg_file.Egg.Impl;

No with'ing problems here!

... Bill

-- 
e-mail: Bill.Beckwith@ois.com       |    Team Ada
Objective Interface Systems, Inc.   | dist, full O-O
1895 Preston White Drive, Suite 250 | multithreading
Reston, VA  22091-5448  U.S.A.      |    built in



  reply	other threads:[~1994-10-04  2:12 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-09-27 16:52 Mut. Recurs. in Ada9X w/o Breaking Encaps.? (LONG) John Volan
1994-09-27 18:48 ` Mark A Biggar
1994-09-29  1:46   ` John Volan
1994-09-29 13:57     ` Tucker Taft
1994-09-29 17:20       ` Bjarne Stroustrup <9758-26353> 0112760
1994-09-30  1:38         ` Tucker Taft
1994-09-30 12:33           ` Bjarne Stroustrup <9758-26353> 0112760
1994-09-29 18:37       ` John Volan
1994-09-29 19:34         ` David Weller
1994-09-30 22:13           ` John Volan
1994-10-02  3:31             ` Andrew Lees
1994-09-30  1:47         ` Tucker Taft
1994-09-30 13:30           ` John Volan
1994-09-29 18:10     ` R. William Beckwith
1994-10-03  0:33     ` Cyrille Comar
1994-09-28 14:01 ` Norman H. Cohen
1994-09-29  2:12   ` John Volan
1994-09-29 14:01     ` Tucker Taft
1994-09-29 18:37     ` Norman H. Cohen
1994-09-29  9:48   ` Magnus Kempe
1994-09-29 13:10     ` Magnus Kempe
1994-09-29 18:05       ` Tucker Taft
1994-09-30 10:20         ` Mut. Recurs. in Ada9X w/o Breaking Encaps.? Magnus Kempe
1994-09-30 13:22           ` Tucker Taft
1994-10-01  1:24       ` Mut. Recurs. in Ada9X w/o Breaking Encaps.? (LONG) Adam Beneschan
1994-10-01 12:01         ` Magnus Kempe
1994-10-01 18:43         ` Mark A Biggar
1994-10-02 16:41         ` John Volan
1994-10-02 23:33           ` Matt Kennel
1994-10-03  8:07           ` Mut. Recurs. in Ada9X w/o Breaking Encaps.? Magnus Kempe
1994-10-03 12:14           ` Mut. Recurs. in Ada9X w/o Breaking Encaps.? (LONG) Robert I. Eachus
1994-10-04  2:12             ` R. William Beckwith [this message]
1994-10-04 16:00             ` John Volan
1994-10-05 11:42               ` Robert I. Eachus
1994-10-05 21:09               ` Matt Kennel
1994-10-03 20:29           ` Harry Koehnemann
1994-09-29 13:35     ` John Volan
1994-09-30 20:27       ` Norman H. Cohen
1994-10-01  1:47         ` John Volan
1994-10-01 20:44           ` Tucker Taft
1994-10-03 11:29           ` Robert I. Eachus
1994-09-30 22:46       ` Matt Kennel
1994-10-01  2:11         ` John Volan
replies disabled

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