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,fba47412041a3607 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!i12g2000prf.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Differences with/without .all Date: Mon, 17 Mar 2008 15:51:34 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <647ktoF2acjggU1@mid.individual.net> <871w696pxz.fsf@ludovic-brenta.org> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1205794294 21295 127.0.0.1 (17 Mar 2008 22:51:34 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 17 Mar 2008 22:51:34 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: i12g2000prf.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:20458 Date: 2008-03-17T15:51:34-07:00 List-Id: On Mar 17, 1:44 pm, Ludovic Brenta wrote: > Alex R. Mosteo writes: > > Hello people, > > > Gnat is giving me an error depending on if I use the .all > > abbreviation or not. I had the (unresearched) idea that there > > should be no differences besides the aesthetic one[*], so I'm not > > sure if gnat's wrong or I'm (guess what ;) ) > > > One way or the other, I'd like to know the explanation. The > > particular case that is giving me problems in GPL 2007 is: > > > protected type Safe; > > type Safe_Access is access all Safe; > > function S return Safe_Access; > > > S.Some_Procedure; > > -- This fails with > > -- Prefix of protected procedure or entry call must be variable > > > S.all.Some_Procedure; > > -- This compiles and runs OK. > > > Your judgment? > > The compiler is correct. > > 6.4(9): "When there is an actual_parameter_part, the prefix can be an > implicit_dereference of an access-to-subprogram value." > > In other words, in the absence of actual parameters, you must use an > explicit_dereference, i.e. you must specify ".all". Sorry, this rule doesn't apply. First of all, it's 6.4(8), not 6.4(9) [just to help anyone else who wants to look it up]. Second, this rule applies when an access-to-subprogram value is involved in the expression---and there are no access-to-subprogram values (or types) in this example, just an access-to-protected-object. Perhaps you're confusing an "access-to-subprogram" with a "function that returns an access type". I think the compiler is wrong. [The main reason for 6.4(8) is: Suppose "Func" denotes an access-to- function type. If you say Func(param,param,param), this results in an implicit dereference of Func, and a call to the function pointed to by Func. But you cannot get a call to the function pointed to by Func if there is no parameter list, even if the function type doesn't have any parameters, or all parameters have defaults. You must to say Func.all in that case.] -- Adam