From: "ophir.geffen@gmail.com" <ophir.geffen@gmail.com>
Subject: using put procedure with a generic package
Date: Wed, 7 May 2008 20:27:19 -0700 (PDT)
Date: 2008-05-07T20:27:19-07:00 [thread overview]
Message-ID: <151bc418-a6e4-47ef-ab7f-5b93a3cedb58@r66g2000hsg.googlegroups.com> (raw)
Hi
I'm trying to write a generic queue package with a Put procedure in it
like this...
* queues.ads:
with Ada.Text_IO;
generic
type Item is private;
with procedure Item_Put(The_Item : in Item);
package Queues is
type Queue is private;
...
procedure Put(The_Item : in Item); --- this uses Item_Put
...
end Queues;
* and use it in test_queues.adb:
with Ada.Text_IO, Queues;
use Ada.Text_IO;
procedure Test_Queues is
package Int_IO is new Ada.Text_IO.Integer_IO(Integer);
package Int_Queues is new Queues(Item => Integer, Item_Put =>
Int_IO.Put); --- error here
...
end Test_Queues;
The package compiles on its own, but when I try to compile Test_Queues
there is an error:
no visible subprogram matches the specification for "Item_Put"
What is the problem and how can I solve it?
The package worked when it was a non generic package and I had Item
defined as a private subtype.
Btw, I use Ada 95 with gnat.
Thanks in advance
next reply other threads:[~2008-05-08 3:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-08 3:27 ophir.geffen [this message]
2008-05-08 4:09 ` using put procedure with a generic package Jeffrey R. Carter
2008-05-08 4:48 ` ophir.geffen
2008-05-08 7:24 ` Dmitry A. Kazakov
2008-05-08 15:54 ` Adam Beneschan
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox