From: Egil H H <ehh.public@gmail.com>
Subject: Re: [Ada95] Private non-generic children of generics not allowed
Date: Thu, 29 Apr 2021 04:02:00 -0700 (PDT) [thread overview]
Message-ID: <56dc220e-1341-4a9f-98cc-132c8afdc2afn@googlegroups.com> (raw)
In-Reply-To: <e05ca45e-a201-43e7-8397-0b3f7089b2d0n@googlegroups.com>
On Thursday, April 29, 2021 at 12:20:07 PM UTC+2, Vincent Marciante wrote:
>
> (My specific need is in trying to keep down code duplication in a few different implementations
> of a generic package: separate body parts/files for each different implementation appear in different
> subdirectories and the build system picks the correct ones depending on the variant being built.
So what you want is a separate package/procedure/function:
generic
package Generic_Foo is
procedure Bar;
end Generic_Foo;
--
package body Generic_Foo is
Name : String := "generic Foo";
package Baz is
procedure Qux;
end Baz;
package body Baz is separate; -magic!
procedure Bar is
begin
Baz.Qux;
end Bar;
end Generic_Foo;
--
with Ada.Text_IO;
separate(Generic_Foo)
package body Baz is
procedure Qux is
begin
Ada.Text_IO.Put_Line("Separate body of " & Name);
end Qux;
end Baz;
(Sorry in advance for google messing up indentation/formatting)
next prev parent reply other threads:[~2021-04-29 11:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-26 15:43 [Ada95] Private non-generic children of generics not allowed Vincent Marciante
2021-04-26 16:41 ` AdaMagica
2021-04-26 16:53 ` Vincent Marciante
2021-04-26 17:16 ` AdaMagica
2021-04-28 12:09 ` Vincent Marciante
2021-04-28 17:57 ` AdaMagica
2021-04-29 8:57 ` AdaMagica
2021-04-29 10:20 ` Vincent Marciante
2021-04-29 11:02 ` Egil H H [this message]
2021-04-29 17:17 ` Vincent Marciante
2021-04-29 17:43 ` AdaMagica
2021-04-29 19:29 ` Vincent Marciante
2021-04-30 12:56 ` AdaMagica
2022-04-28 0:07 ` Thomas
2022-05-19 19:59 ` Indra Anita
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox