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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: Problem with generic linked list package Date: Sat, 09 Aug 2014 08:22:07 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <85a97spo1c.fsf@stephe-leake.org> <92dd7d22-a7da-44d7-9c40-b3aa62881683@googlegroups.com> <4f431041-5292-434d-988e-46d69f4800f8@googlegroups.com> <472a5732-3dc9-4c08-8bda-00720375a2a9@googlegroups.com> <8cc86d41-2c7e-42d7-b057-1f9f010d9002@googlegroups.com> <75864d79-609c-4e37-98d8-6b5f050ad59d@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 9 Aug 2014 15:22:09 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="a0c81a81d1281113b3831cf0c04e791a"; logging-data="15143"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/a3vhN0IsAkvxe1ZofqYDwohjiIZWVNDs=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 In-Reply-To: <75864d79-609c-4e37-98d8-6b5f050ad59d@googlegroups.com> Cancel-Lock: sha1:7XtlPl4HUp2SzLLfPmkThqqDFYI= Xref: news.eternal-september.org comp.lang.ada:21602 Date: 2014-08-09T08:22:07-07:00 List-Id: On 08/09/2014 07:32 AM, Laurent wrote: > > with function "<"(Left, Right : Element) return Boolean is <>; > with function "="(Left, Right : Element) return Boolean is <>; > > There is no "<" and "=" defined for Element_Type, normally. So the "<>" seems to do the trick but why? > The box tells the compiler that it will get the info it needs later. But in this case there is no later, isn't it? The box means, if no explicit actual subprogram is provided, and there is visible at the point of instantiation a subprogram with the same name and the same parameter and return type profile (substituting the actual for Element), then the instantiation will use that visible subprogram. You can still provide an explicit actual subprogram: "<" => "<" "=" => Equal Now, suppose you have a type T for which "<" is not meaningful. You want to have a linked list of T, but will never use Insert_In_Order. Can you still use your package to do this? If not, how could you change your package to support this, while still providing Insert_In_Order for types with "<"? -- Jeff Carter "Insufficient laughter--that's grounds for divorce." Play It Again, Sam 126