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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fb4dd933ef563a8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-08 05:17:15 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: antonio_duran@hotmail.com (Antonio Duran) Newsgroups: comp.lang.ada Subject: Re: When/Why can a compiler reject an operator but accept a name? Date: 8 Jul 2002 05:17:14 -0700 Organization: http://groups.google.com/ Message-ID: References: <3D25D271.ACE6DAC8@despammed.com> NNTP-Posting-Host: 192.101.1.126 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1026130635 20647 127.0.0.1 (8 Jul 2002 12:17:15 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 8 Jul 2002 12:17:15 GMT Xref: archiver1.google.com comp.lang.ada:26937 Date: 2002-07-08T12:17:15+00:00 List-Id: Wes Groleau wrote in message news:<3D25D271.ACE6DAC8@despammed.com>... > In package G I have: > > type List_Type is array (Natural range <>) of Item; > > type Order is access function (Left, Right : in Item) return > Boolean; > > procedure Sort (List : in out List_Type; Sequence : in Order); > > > In procedure P I had: > > package I is new G (Item); > > function "<" (Left, Right : in Item) return Boolean is > > ..... > > I.Sort (List => List, Sequence => "<"'Access); > > > Compiler rejected it, saying: > > "<" has no definition that matches function (Left, Right : in Item) > return Boolean [RM_95 3.10.2(32)] > > I replaced "<" with Ord_Check (no other changes), and > the compiler accepted it. > > Does using an operator instead of a name make the > function Intrinsic? > > If not, there is no support for rejection in 3.10.2(32) > Is there any reason elsewhere in the RM to justify this > odd behavior? > > (Certainly either way, the message could be improved!) ARM 3.10.2 1 says: "The attribute Access is used to create access values designating aliased objects and non-intrinsic subprograms. The “accessibility” rules prevent dangling references (in the absence of uses of certain unchecked features — see Section 13)." So what I think is happening is that you're instanciating G with a type that has an intrinsic "<" operator. For example, if you use Integer, in your P procedure you must write a customized "<" operator like: with G; procedure P is package I is new G(Integer); function "<"(Left, Right: in Integer) return Boolean is begin return Standard."<"(Left, Right); end "<"; -- More stuff here. begin -- More stuff here. end P; Regards, Antonio Duran.