From: Stephen Leake <stephen_leake@acm.org>
To: comp.lang.ada@ada-france.org
Subject: Re: generic with procedure
Date: 29 Sep 2004 19:47:53 -0400
Date: 2004-09-29T19:47:53-04:00 [thread overview]
Message-ID: <mailman.133.1096501690.390.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <cjcub4$tlm$05$1@news.t-online.com>
"Rick Santa-Cruz" <rick_santa_cruz75@msn.com> writes:
> But this has to be part of a procedure, so that it will compile
> correctly?
Sorry. Here's a fully compileable example:
with Ada.Text_IO; use Ada.Text_IO;
procedure Rick
is
generic
type Element is private;
package MyContainer_2a is
generic
with procedure Some_Proc(Item : Element);
procedure Foo (Item : Element);
end MyContainer_2a;
package body MyContainer_2a is
procedure Foo (Item : in Element)
is begin
Put_Line ("Foo 2a");
Some_Proc (Item);
end Foo;
end MyContainer_2a;
generic
type Element is private;
package MyContainer_2b is
generic
procedure Some_Proc(Item : Element);
end MyContainer_2b;
package body MyContainer_2b is
procedure Some_Proc (Item : Element)
is begin
Put_Line ("Some_Proc 2b");
end Some_Proc;
end MyContainer_2b;
package Container_2a is new MyContainer_2a (Integer);
procedure Proc_2a (Item : Integer)
is
pragma Unreferenced (Item);
begin
Put_Line ("hello 2a");
end Proc_2a;
procedure Bar is new Container_2a.Foo (Proc_2a);
package Container_2b is new MyContainer_2b (Integer);
procedure Proc_2b is new Container_2b.Some_Proc;
begin
Bar (1);
Proc_2b (2);
end Rick;
--
-- Stephe
next prev parent reply other threads:[~2004-09-29 23:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-28 21:52 generic with procedure Rick Santa-Cruz
2004-09-28 23:56 ` Stephen Leake
2004-09-29 0:06 ` Rick Santa-Cruz
2004-09-29 23:47 ` Stephen Leake [this message]
2004-09-29 2:11 ` Georg Bauhaus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox