From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Problem with limited with
Date: Sat, 27 Jul 2013 21:51:32 -0500
Date: 2013-07-27T21:51:32-05:00 [thread overview]
Message-ID: <kt20vl$oja$1@loke.gir.dk> (raw)
In-Reply-To: kt0uo3$3kh$1@dont-email.me
"Jeffrey Carter" <spam.jrcarter.not@spam.not.acm.org> wrote in message
news:kt0uo3$3kh$1@dont-email.me...
> On 07/27/2013 09:00 AM, Shark8 wrote:
>>
>> To be fair, the ONLY reason I have to use anonymous access types at all
>> there
>> is because GNAT chokes up when I try to use the type itself. (I think
>> there's
>> a comment to that effect elsewhere.)
>
> About the only thing you can do with limited with is declare access types
> designating the types in the withed pkg, So of course an Ada compiler
> complains if you try to do anything else.
Not true in Ada 2012. We realized that the language didn't need all of the
restrictions on incomplete types that it had, and we removed a lot of them.
See 3.10.1 and 13.14. The trick is that freezing a subprogram need not
freeze the types of its profile -- that's only needed when there is a call
or a body.
In particular, any incomplete type can be used as the name of a parameter so
long as it is completed before the body of the subprogram is encountered.
(The actual rules are a bit more complex than this, but this is the best way
to think of it.) For limited with, this just means that a matching
non-limited with has to be visible in the body of the package. As this is
new, I can imagine that GNAT has bugs in this area. (I think the OP's code
should compile, but I didn't check this in detail.)
The net effect is that you can use a type imported via a limited with
without having any visible access types. (You can't have functions that
return such types, or components, because those need to know more about the
type than is available.)
Randy.
next prev parent reply other threads:[~2013-07-28 2:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-26 19:14 Problem with limited with Simon Wright
2013-07-26 20:49 ` Jeffrey Carter
2013-07-26 22:17 ` Adam Beneschan
2013-07-26 22:25 ` Shark8
2013-07-26 22:35 ` Simon Wright
2013-07-27 0:17 ` Jeffrey Carter
2013-07-27 1:08 ` Adam Beneschan
2013-07-27 8:05 ` Simon Wright
2013-07-27 2:32 ` Shark8
2013-07-27 5:42 ` Jeffrey Carter
2013-07-27 16:00 ` Shark8
2013-07-27 17:13 ` Jeffrey Carter
2013-07-27 19:21 ` Simon Wright
2013-07-28 2:51 ` Randy Brukardt [this message]
2013-07-27 3:55 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox