comp.lang.ada
 help / color / mirror / Atom feed
From: markb@sdcrdcf.UUCP (Mark Biggar)
Subject: Re: Implementing mutually dependent access types in separate packages
Date: Thu, 11-Jul-85 13:52:19 EDT	[thread overview]
Date: Thu Jul 11 13:52:19 1985
Message-ID: <2142@sdcrdcf.UUCP> (raw)
In-Reply-To: 383@boulder.UUCP

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

  parent reply	other threads:[~1985-07-11 17:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1985-07-07 23:19 Implementing mutually dependent access types in separate packages Geoffrey M. Clemm
1985-07-08  1:19 ` Geoffrey M. Clemm
1985-07-11 17:52 ` Mark Biggar [this message]
1985-08-09 18:07   ` Geoffrey M. Clemm
replies disabled

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