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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,814577151c84863d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-18 12:33:05 PST Path: archiver1.google.com!postnews2.google.com!not-for-mail From: adam@irvine.com (Adam Beneschan) Newsgroups: comp.lang.ada Subject: Re: which compiler is right? Date: 18 Mar 2004 12:33:04 -0800 Organization: http://groups.google.com Message-ID: References: <105iblbigdett75@corp.supernews.com> NNTP-Posting-Host: 66.126.103.122 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1079641985 5330 127.0.0.1 (18 Mar 2004 20:33:05 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 18 Mar 2004 20:33:05 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:6418 Date: 2004-03-18T12:33:04-08:00 List-Id: "Randy Brukardt" wrote in message news:<105iblbigdett75@corp.supernews.com>... > "Adam Beneschan" wrote in message > news:b4682ab7.0403170927.cc800a5@posting.google.com... > ... > > Since the score is currently 2-0 that the code should be illegal, > > maybe I should point out that not everyone agrees with this analysis, > > before you decide it's necessary to fix your code. My belief is that > > since the Priority routine declared in Pkg2 is declared in a different > > scope than whatever type will be used to instantiate Pkg2, Priority is > > neither a primitive subprogram nor is overriding. I think GNAT is > > correct to accept the code. > > I thought that too, but that's not what the language says. Routines can be > overriding if they are inherited, anywhere. I'm not sure how this is pertinent, since the routine causing the error is not inherited. > That's so that a type declared > in a body can have overriding routines, even though it can't have > primitives. Scopes have absolutely nothing to do with overriding (look at > 8.3 again if you don't believe me). Sorry, I looked at it and I still don't believe you. 8.3(9) says that a declaration can override another homograph if the declaration "occurs immediately within the same declarative region", etc. The term "immediately within a declarative region" is defined by 8.1(13) and most definitely has to do with scopes. If you declare a routine in a nested inner package, it cannot override a routine declared (implicitly or explicitly) in an outer package, because the routine in the inner package is not *immediately* declared in the same declarative region as the routine declared in the outer package. If you are aware of this and still maintain that scopes have nothing to do with overriding, then I'm afraid I'm not following you. > Similarly, primitiveness has nothing to > do with it. Primitiveness has nothing to do with whether a routine is overriding; but since the compiler in the original example reported an error because it thought the declared routine was primtive, it's certainly relevant to the problem. Again, I'm probably just not understanding you correctly. > I think it should be illegal simply because it is very confusing. This looks > like an overriding routine, but it is not. Now I'm convinced that I'm lost. I thought you were disagreeing with me when I said the function (i.e. the Priority explicitly declared in the generic) is not an overriding routine? > And if it is not overriding, > calls outside of the generic are almost certainly ambigious (for use clause > users, anyway). If you instantiate Pkg2 and then USE the instantiation, then calls to Priority might be ambiguous (depending on whether the Priority operation of the actual type is directly visible). -- Adam