From: "Nick Roberts" <nickroberts@callnetuk.com>
Subject: Re: better way?
Date: Wed, 3 Jan 2001 05:00:31 -0000
Date: 2001-01-03T05:00:31+00:00 [thread overview]
Message-ID: <931r2k$4ai5t$1@ID-25716.news.dfncis.de> (raw)
In-Reply-To: 16D06.22140$A06.845242@news1.frmt1.sfba.home.com
I believe the orthodox answer to this would be that, since the two types
Inner_A_Thing_Type and Inner_B_Thing_Type are so closely related, the
definitions of these types and their primitive operations all belong
immediately within the one package. I illustrate below (with names changed
to hopefully increase clarity a tad).
package MacDonalds_Ultra is
type Diner_Type is [tagged] [limited] private;
type Meal_Type is [tagged] [limited] private;
procedure Eat (Diner: in out Diner_Type; Meal: in Meal_Type['Class]);
procedure Configure_Nutritional_Balance (Meal: in out Meal_Type; Diner:
in Diner_Type['Class]);
...
private
...
end MacDonalds_Ultra;
It doesn't seem immediately obvious to me why you wouldn't want to adopt
this approach, at least as a starting point. Sometimes it is useful to
define further packages which present essentially the same types and
operations in a different way. I think Ada.Text_IO shows a fairly good
example of the meaningful use of inner packages.
--
Nick Roberts
http://www.AdaOS.org
<tmoran@acm.org> wrote in message
news:16D06.22140$A06.845242@news1.frmt1.sfba.home.com...
> I'd like to do something like:
> package Outer is
>
> type Inner_A_Thing_Type;
> type Inner_B_Thing_Type;
>
> package Inner_A is
> type Thing_Type is ...
> procedre P(X : access Inner_B_Thing_Type);
> end Inner_A;
> subtype Inner_A_Thing_Type is Inner_A.Thing_Type;
>
> package Inner_B is
> type Thing_Type is ...
> procedre Q(X : access Inner_A_Thing_Type);
> end Inner_B;
> subtype Inner_B_Thing_Type is Inner_B.Thing_Type;
> ...
> end Outer;
>
> but the "subtype" instead of "type" prevents it. Suggestions?
next prev parent reply other threads:[~2001-01-03 5:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-12-22 7:08 better way? tmoran
2000-12-23 3:12 ` Robert Dewar
2000-12-27 9:00 ` mark_lundquist
2001-01-03 5:00 ` Nick Roberts [this message]
2001-01-05 18:46 ` tmoran
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox