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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,487310d7e1471eac X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: parent package referring to child Date: Wed, 10 Oct 2007 23:12:16 -0500 Organization: Jacob's private Usenet server Message-ID: References: <1191997397.865251.322480@d55g2000hsg.googlegroups.com> <1192028394.287114.182670@o3g2000hsb.googlegroups.com> <1192042440.388079.69040@o80g2000hse.googlegroups.com> <1192044748.953712.248880@v3g2000hsg.googlegroups.com> <1192047607.865747.220890@50g2000hsm.googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: jacob-sparre.dk 1192075765 29729 69.95.181.76 (11 Oct 2007 04:09:25 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 11 Oct 2007 04:09:25 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1896 Xref: g2news2.google.com comp.lang.ada:2427 Date: 2007-10-10T23:12:16-05:00 List-Id: "Adam Beneschan" wrote in message news:1192047607.865747.220890@50g2000hsm.googlegroups.com... > On Oct 10, 12:32 pm, Matthew Heaney wrote: ... > > No, that's wrong. In this case you can use mode inout because type T > > is tagged (meaning that it's passed by reference). > > I don't see what the parameter mode has to do with it. The mode has nothing do to with it; but the rule is that a tagged incomplete type (which is what you get in a limited view) can be used as a parameter. See 3.101(8.2/2). > I can't find a rule that would make "procedure Op (O : in P.C.T);" illegal. It's the absence of a rule: see the only allowed uses for incomplete types: see 3.10.1(5-9.4/2). Note that 3.10.1(9.4/2) says that no other uses are allowed. Use as a parameter is not allowed for untagged types. ... > Also, the "by reference" comment isn't relevant either. It is relevant as it is the reason that tagged incomplete types can be used as parameters (because the compiler doesn't need to know the real type in order to know how it is passed as a parameter - this same property is needed to be able to deal with classwide types which is why it is fundamental to tagged types); you don't know that for untagged types so they aren't allowed. I think I was the originator of this idea; it allows you to make classwide calls for objects of types that you don't actually know about. (I'm not sure that it is as useful as I originally thought, but it certainly is a less-restrictive rule.) ... > > Try it! > > That doesn't seem to be particularly good advice. You can "try it" > only by running it through a compiler, but that still won't tell you > whether the code is illegal because many compilers accept a lot of > code that they shouldn't. I know GNAT has accepted plenty of illegal > code in the past. (Some of the bugs have been fixed in later > versions.) I think Matt was trying more to convince the skeptical that this works. But I agree that you can't rely only on a compiler to realize that this works; it helps to know the rules and motivation. Randy.