comp.lang.ada
 help / color / mirror / Atom feed
* using put procedure with a generic package
@ 2008-05-08  3:27 ophir.geffen
  2008-05-08  4:09 ` Jeffrey R. Carter
  0 siblings, 1 reply; 5+ messages in thread
From: ophir.geffen @ 2008-05-08  3:27 UTC (permalink / 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




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-05-08 15:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-08  3:27 using put procedure with a generic package ophir.geffen
2008-05-08  4:09 ` 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

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