From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 X-FeedAbuse: http://nntpfeed.proxad.net/abuse.pl feeded by 78.192.65.63 Path: border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!proxad.net!feeder2-2.proxad.net!nntpfeed.proxad.net!news.muarf.org!news.ecp.fr!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Problem with limited with Date: Sat, 27 Jul 2013 21:51:32 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <42dc042d-e458-42a4-abb7-23907982b88f@googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: loke.gir.dk 1374979893 25194 69.95.181.76 (28 Jul 2013 02:51:33 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Sun, 28 Jul 2013 02:51:33 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Original-Bytes: 3014 Xref: number.nntp.dca.giganews.com comp.lang.ada:182725 Date: 2013-07-27T21:51:32-05:00 List-Id: "Jeffrey Carter" 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.