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,6ea9f886a228469c X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Thu, 17 Feb 2005 17:09:40 -0600 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <344d0fee.0502150410.740d5dbd@posting.google.com> <17cfosskqxdi0$.1ux9v3kndb9kr$.dlg@40tude.net> <344d0fee.0502160127.432c8614@posting.google.com> Subject: Re: pointers and genericity Date: Thu, 17 Feb 2005 17:11:27 -0600 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-HmBVkwhSSV/G6bOQjjAyaO/U2pi5Req4VnenyN4CXhhrYVrWGMpxyxk+6aFNBTIPJhTKsvkAoxhfpLN!JHfqAAnEdzX9q1P+RbprRTPrvyYyBOAqB9orUFyFi9gyMkpNuB6f4ERL/XlNvPs+5ENR7EPyil9v 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.31 Xref: g2news1.google.com comp.lang.ada:8398 Date: 2005-02-17T17:11:27-06:00 List-Id: "Robert A Duff" wrote in message news:wccsm3wo8hv.fsf@shell01.TheWorld.com... ... > If the access type is outside the generic body, then it's illegal > to take 'Access of a procedure declared inside the generic body. > The workaround is to declare the procedure in the generic > package spec. If you don't want to export it, put it in > the private part. > > I think the reason for this rule has something to do with making it > easier to implement code sharing of generic bodies. The root reason for the rule is to avoid contract problems with the accessibility checks. (As it says in the AARM!). Unlike objects, accessibility checks for subprograms are always done at compile-time. Since we don't know where the generic will be instantiated, and we never look in bodies after the template is compiled, we need an assume-the-worst rule for the check. This is it. Yes, it makes the implementation easier, but that's not the only (or even major) motivation. Note that this rule was changed in Ada 2005 (AI-229) because it still allowed the creation of dangling pointers. In so doing, we also relaxed it a bit. Randy.