comp.lang.ada
 help / color / mirror / Atom feed
From: geoff@boulder.UUCP (Geoffrey M. Clemm)
Subject: Re: Implementing mutually dependent access types in separate packages
Date: Fri, 9-Aug-85 14:07:09 EDT	[thread overview]
Date: Fri Aug  9 14:07:09 1985
Message-ID: <394@boulder.UUCP> (raw)
In-Reply-To: 2142@sdcrdcf.UUCP

A month ago I solicited suggestions on how to place the parts of a
mutually recursive set of data structures into different packages.  All
parts refer to other parts through access types, and therefore the various
record definitions should appear in the package bodies to avoid unnecessary
compilation dependencies.

In article <2142@sdcrdcf.UUCP> markb@sdcrdcf.UUCP (Mark Biggar) writes:
>You should have read section 3.8.1 more carefully.
(Mark, you should have read the posting more carefully, see below :-)
>
>[This section] says 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;
>
... same for B
>
>with B; use B;
>package body A is
>    type ATYPE is record
>	B: BTYPEPTR;
>    end record;
>end A;
... etc.
>
>Note that there is no cycle in the compilation order as the package specs
>can be compiled before any of the bodies.

From the original posting :
>Note:
>   If one was not required to provide accessing functions of the form
>   "ATYPE_BTYPE(ATYPEPTR) RETURN BTYPEPTR", there of
>   course would be no problem, but these accessing functions are critical.

Since I have only received two responses which both left out the critical
accessing functions, should I assume that it cannot be done properly in ADA ?

(Where "properly" is defined as 
   1. separate packages for each data structure that is a part of
      the mutually recursive set of data structures
   2. record implementations hidden inside the package bodies
)

      reply	other threads:[~1985-08-09 18:07 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
1985-08-09 18:07   ` Geoffrey M. Clemm [this message]
replies disabled

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