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,8f7d6c5172a1d41b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Mon, 18 Dec 2006 19:47:51 -0600 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <45853BDC.5000902@obry.net> Subject: Re: How to get around "access type must not be outside generic unit" Date: Mon, 18 Dec 2006 19:48:49 -0600 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.1807 Message-ID: <2bmdnS4ilvNa2RrYnZ2dnUVZ_r2onZ2d@megapath.net> NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-RPO6JxcPgnMBapd/+ZiN9Ld0DHu9dp4SaeQ3zJsiexhMMukvXfu/w4nXvhfDrjIx/LezANsBa2s8j7Q!CtOlD+88c4fAcNVFbWQT90UStE2gt47Hv2oDXmObsvMPtucYDYMctH3zAaS99klXxYLp/zD6OsD9!vB3CUi9VKdU6JA== X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news2.google.com comp.lang.ada:7950 Date: 2006-12-18T19:48:49-06:00 List-Id: "Brian May" wrote in message news:sa47iwo94o8.fsf@margay.local... > >>>>> "Jean-Pierre" == Jean-Pierre Rosen writes: ... > Jean-Pierre> Taking the 'access in the specification is illegal, > Jean-Pierre> and (as explained above), the instantiation would be > Jean-Pierre> illegal. > > I get lost here. Why is taking the 'access value in the specification > illegal if the generic has been instantiated inside a procedure? The accessibility check fails. That's the check that prevents dangling pointers. JP is assuming that the Register routine and it's access type is declared at the library level when he "says inside of a procedure". Note that the rule is "assume-the-worst", and it is always possible to instantiate at a more nested level than the Register routine is defined. So the 'access is always illegal in a body. OTOH, in specifications the rule is "assume-the-best and recheck on instantiation". So if you put the 'access in the private part, it is OK (until you write a nested instance, but then that instance is illegal). Randy.