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,e1c47fd1b76b1c05 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.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: Thu, 07 Apr 2005 18:20:56 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <4253B917.5070800@mailinator.com> <4254E00C.30908@mailinator.com> Subject: Re: Task entries and access to subprograms. Date: Thu, 7 Apr 2005 18:23:17 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4927.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4927.1200 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-cKmHWMu2V74wIDvqZjvDqbnAWj5Zg+NuIcybHLIUCO8YMAGDxMZ0xaEYxySMEMCapLE7myuZhSFyu/L!AA95ibsiEUW4I1u9JVmVzczYO+eCnG0CPaV0JL0xHBhcemsvqqFMyJJm1GYbDlSGkfUd6UZHGt6C 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: g2news1.google.com comp.lang.ada:10324 Date: 2005-04-07T18:23:17-05:00 List-Id: "Alex R. Mosteo" wrote in message news:4254E00C.30908@mailinator.com... > Jeffrey Carter wrote: > > Alex R. Mosteo wrote: > > > >> type AInt is access all Integer; > >> type Code is access procedure; > > > > > >> entry Two (I : AInt); -- No complaint. Legal? > > > > > > This was legal in Ada 83, and that wasn't changed by Ada 95. > > > >> entry Four (C : Code); -- No complaint. > > > > > > There's a difference between access parameters and parameters of an > > access type. > > Yep. I just feel a bit disturbed when something with a so easy > workaround is forbidden. Workaround, yes. But these things aren't at all the same, which is obvious if you think about all of the implications. (I know Bob has given the actual reason for the rule, but his explanation is more for language lawyers.) Consider the two similar subprograms declared in a library package specification: type Acc_Int is access Integer; procedure One (P : Acc_Int); procedure Two (A : access Integer); On the surface, these appear the same. But they have very different accessibility rules. That's easy to see when you make a call: procedure Test is Foo : aliased Integer; begin One (Foo'Access); -- Illegal! Fails accessibility check. Two (Foo'Access); -- OK end Test; Any accessibility checks needed will be done in the body of Two, while for One, they're done at the point of the call. Bob's point is that the standard implementation of the accessibility check won't work for an entry; and there is no other obvious no-distributed-overhead implementation available, thus writing the anonymous parameter with its complicated accessibility is prohibitied. (You could implement the check with a fully dynamic accessibility level, but this would have a cost on every scope entrance and exit, and that would be too much to swallow.) Hope this makes it clear. (One could argue that the accessibility rules shouldn't have been different, but that's water under the dam at this point.) Randy.