comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Problem with generic package
Date: Tue, 15 Apr 2014 21:41:42 +0100
Date: 2014-04-15T21:41:42+01:00	[thread overview]
Message-ID: <ly4n1ul3zt.fsf@pushface.org> (raw)
In-Reply-To: 1ffb84f0-5e50-4807-90ff-dfdfac11c501@googlegroups.com

Laurent <daemon2@internet.lu> writes:

>    procedure Sort_Generic (List : in out List_Type) is
>
>       -- We need to make an instance of Swap_Generic for this case
>
>       error ==>procedure Exchange is new Swap_Generic (Value_Type => Element_Type); <== error

You do *not* need to make an instance of Swap_Generic; within the body
of Array_Generic you can refer to Swap_Generic as it is. And, as Adam
says, Swap_Generic isn't actually a generic subprogram in its own right,
it's "just" a subprogram in a generic package.

The compiler messages I got were

   array_generics.adb:18:33: expect generic subprogram in instantiation
   array_generics.adb:36:13: "Exchange" is undefined

so delete the first line and replace Exchange by Swap_Generic in the
second.


By the way, GNAT works much better if you stick with lower-case file
names (I think your code wouldn't compile on Linux, which has
case-sensitive file names; when compiling Array_Generics.adb GNAT
expects to find array_generics.ads, not Array_Generics.ads).

  parent reply	other threads:[~2014-04-15 20:41 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
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 [this message]
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