From: Adam Beneschan <adambeneschan@gmail.com>
Subject: Re: Problem with generic package
Date: Tue, 15 Apr 2014 12:44:25 -0700 (PDT)
Date: 2014-04-15T12:44:25-07:00 [thread overview]
Message-ID: <596f076f-919e-4cd2-bb2e-ad0134e0d5c3@googlegroups.com> (raw)
In-Reply-To: <1ffb84f0-5e50-4807-90ff-dfdfac11c501@googlegroups.com>
Sorry, I was a bit hasty with my previous response. I was looking just at the code you posted here, which wasn't complete information. On looking at the code at your github site, I think I see what's going on.
The problem is that in this line:
procedure Exchange is new Swap_Generic (Value_Type => Element_Type);
since you have a Swap_Generic in the same package body, the compiler thinks that's what the name Swap_Generic refers to. But it looks like you also have a top-level generic procedure Swap_Generic. I assume that's what the above line was trying to instantiate.
First of all, you need to put "with Swap_Generic;" at the top of Array_Generics.adb; otherwise the top-level generic procedure can never be used.
Then, since the name of the other non-generic Swap_Generic hides the one you've WITH'ed, you need to say this in order to instantiate the generic Swap_Generic:
procedure Exchange is new
Standard.Swap_Generic (Value_Type => Element_Type);
since all top-level units are children of Standard. The compiler cannot use "overload resolution" to find the correct Swap_Generic because generics cannot be overloaded with anything.
-- Adam
next prev parent reply other threads:[~2014-04-15 19:44 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 [this message]
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