comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Ada0Y limited with
Date: Thu, 30 Sep 2004 18:40:36 -0500
Date: 2004-09-30T18:40:36-05:00	[thread overview]
Message-ID: <iLCdnXDk2sCzBMHcRVn-ig@megapath.net> (raw)
In-Reply-To: pan.2004.09.30.22.23.45.962614@power.com.pl


"Wojtek Narczynski" <wojtek@power.com.pl> wrote in message
news:pan.2004.09.30.22.23.45.962614@power.com.pl...
> Hello,
>
> (GNAT in gcc mainline refuses compile the example from the "An invitation
> to Ada 2005" presentation, claiming "circular unit dependency" error, so
> I have serious problems trying to understand how this is supposed to
work.)
>
> Do I need to declare an access type every time I want to use a a type from
> the limited-withed package, or can I just use the access type declared in
> the limited-withed package?
>
> Which of the following is code illegal?
>
> with Parts;
> package Whole is
>
>    type Whole_Type is record
>       Part : Parts.Part_Type;
>    end record;
>
>    type Whole_Access is access all Whole_Type;
>
> end Whole;
>
>
> limited with Whole;
> package Parts is
>
>    type Part_Type is record
>       Prev : Whole.Whole_Access;
>       Next : access Whole.Whole_Type;
>    end record;
>
> end Parts;

Limited with always gives you an incomplete view of any types, so that
clearly applies to Whole_Access as well.

The reason for expanding the use of anonymous access types is to avoid the
junk conversions needed if you define named access types everywhere that you
use limited withed packages.

So, component Prev is wrong; it should look like component Next.

                 Randy Brukardt.






  reply	other threads:[~2004-09-30 23:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-30 22:23 Ada0Y limited with Wojtek Narczynski
2004-09-30 23:40 ` Randy Brukardt [this message]
2004-10-01  7:52   ` Wojtek Narczynski
2004-10-01 18:30     ` Randy Brukardt
2004-10-01 18:51       ` Wojtek Narczynski
replies disabled

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