Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site sdcrdcf.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!oliveb!hplabs!sdcrdcf!markb
From: markb@sdcrdcf.UUCP (Mark Biggar)
Newsgroups: net.lang.ada
Subject: Re: Implementing mutually dependent access types in separate packages
Message-ID: <2142@sdcrdcf.UUCP>
Date: Thu, 11-Jul-85 13:52:19 EDT
Article-I.D.: sdcrdcf.2142
Posted: Thu Jul 11 13:52:19 1985
Date-Received: Wed, 17-Jul-85 04:41:13 EDT
References: <383@boulder.UUCP>
Reply-To: markb@sdcrdcf.UUCP (Mark Biggar)
Distribution: net
Organization: System Development Corp. R+D, Santa Monica
Lines: 59
Summary: 

You should have read section 3.8.1 more carefully.

	If the incomplete type declaration occurs immediately within the
	private part of a package, then the full type declaration must occur
	later and immediately within either the private part itself,
	OR THE DECLARATIVE PART OF THE CORRESPONDING PACKAGE BODY.
		(3.8.1 para 3, last sentence)

This means that you can do what you want using something similar to the
following:

package A is
    type ATYPEPTR is private;
private
    type ATYPE;
    type ATYPEPTR is access ATYPE;
end A;

package B is
    type BTYPEPTR is private;
private
    type BTYPE;
    type BTYPEPTR is access BTYPE;
end B;

package C is
    type CTYPEPTR is private;
private
    type CTYPE;
    type CTYPEPTR is access CTYPE;
end C;

with C; use C;
package body A is
    type ATYPE is record
	C: CTYPEPTR;
    end record;
end A;

with A; use A;
package body B is
    type BTYPE is record
	A: ATYPEPTR;
    end record;
end B;

with B; use B;
package body C is
    type CTYPE is record
	B: BTYPEPTR;
    end record;
end C;

Note that there is no cycle in the compilation order as the package specs
can be compiled before any of the bodies.

Happy Ada hacking
Mark Biggar
{allegra,burdvax,cbosgd,hplabs,ihnp4,akgua,sdcsvax}!sdcrdcf!markb