comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adambeneschan@gmail.com>
Subject: Re: Problem with generic package
Date: Tue, 15 Apr 2014 12:36:15 -0700 (PDT)
Date: 2014-04-15T12:36:15-07:00	[thread overview]
Message-ID: <585c3cee-0c38-4aa3-b2f0-31bfae14714a@googlegroups.com> (raw)
In-Reply-To: <1ffb84f0-5e50-4807-90ff-dfdfac11c501@googlegroups.com>

On Tuesday, April 15, 2014 11:26:49 AM UTC-7, Laurent wrote:
> Hi
> 
> As an exercise I have created a generic search function. Because my library folder begins to get messy I tried to put some related parts together in a package.
> 
> https://github.com/Chutulu/Library.git
> 
> The generic swap and sort are working as standalone but in my package I get this error:
> 
> expect generic subprogram in instantiation
> 
> No idea what the compiler tries to explain.

> package body Array_Generics is
> 
>    procedure Swap_Generic (Value1, Value2 : in out Element_Type) is

This is not a generic.  Generics begin with the word "generic".  Therefore, you can't instantiate it.

It looks like you want to make this a generic and you want the generic type parameter to be called Value_Type.  Try this:

   generic
      type Value_Type is private;
   procedure Swap_Generic (Value1, Value2 : in out Value_Type) is 
      Temp_Value : Value_Type; 
   begin -- Swap_Generic 
      Temp_Value := Value1; 
      Value1 := Value2; 
      Value2 := Temp_Value; 
   end Swap_Generic; 

                               -- Adam


  reply	other threads:[~2014-04-15 19:36 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-15 18:26 Problem with generic package Laurent
2014-04-15 19:36 ` Adam Beneschan [this message]
2014-04-15 19:44 ` Adam Beneschan
2014-04-15 20:12   ` Laurent
2014-04-15 20:37     ` Adam Beneschan
2014-04-15 20:43     ` Eryndlia Mavourneen
2014-04-15 20:47       ` Eryndlia Mavourneen
2014-04-15 21:28     ` Georg Bauhaus
2014-04-15 20:41 ` Simon Wright
2014-04-15 21:12   ` Laurent
2014-04-15 21:27     ` Adam Beneschan
2014-04-15 21:58       ` Laurent
2014-04-15 22:03         ` Adam Beneschan
2014-04-16  6:03         ` Georg Bauhaus
2014-04-16 20:37           ` Laurent
2014-04-16 21:13             ` Mike H
2014-04-16 22:31               ` Randy Brukardt
2014-04-16 23:06               ` Jeffrey Carter
2014-04-15 22:14     ` Simon Wright
2014-04-16 18:49       ` Laurent
replies disabled

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