comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Problem with generic linked list package
Date: Sat, 09 Aug 2014 08:22:07 -0700
Date: 2014-08-09T08:22:07-07:00	[thread overview]
Message-ID: <ls5eav$ep7$1@dont-email.me> (raw)
In-Reply-To: <75864d79-609c-4e37-98d8-6b5f050ad59d@googlegroups.com>

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

  parent reply	other threads:[~2014-08-09 15:22 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-28 13:26 Problem with generic linked list package Laurent
2014-07-29  7:51 ` Jacob Sparre Andersen
2014-07-29  8:12   ` Laurent
2014-07-29  8:27 ` Stephen Leake
2014-07-29 15:38   ` Laurent
2014-08-07 19:07     ` Laurent
2014-08-07 19:21       ` Adam Beneschan
2014-08-07 19:25         ` Adam Beneschan
2014-08-07 22:20           ` Laurent
2014-08-07 23:35             ` Adam Beneschan
2014-08-08  4:42               ` Laurent
2014-08-09 14:32                 ` Laurent
2014-08-09 14:58                   ` AdaMagica
2014-08-09 15:22                   ` Jeffrey Carter [this message]
2014-08-09 18:51                   ` Shark8
2014-08-09 21:53                     ` Laurent
2014-08-09 22:25                       ` Jeffrey Carter
2014-08-10  8:22                       ` Simon Wright
2014-08-10 10:45                         ` Simon Wright
2014-08-10 20:20                           ` Laurent
2014-08-10 21:57                             ` Simon Wright
2014-08-10 23:42                               ` Jeffrey Carter
2014-08-11  4:51                                 ` Laurent
2014-08-11  5:13                                   ` Jeffrey Carter
2014-08-11  7:56                                     ` Laurent
2014-08-07 20:37       ` Shark8
2014-08-07 22:30         ` Laurent
2014-08-07 23:22           ` Shark8
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox