From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=BAYES_05,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:a37:a156:: with SMTP id k83mr32240454qke.331.1619694121013; Thu, 29 Apr 2021 04:02:01 -0700 (PDT) X-Received: by 2002:a25:9085:: with SMTP id t5mr8842565ybl.504.1619694120851; Thu, 29 Apr 2021 04:02:00 -0700 (PDT) Path: eternal-september.org!reader02.eternal-september.org!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 29 Apr 2021 04:02:00 -0700 (PDT) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=89.8.67.159; posting-account=uulyKwoAAAA86DO0ODu--rZtbje8Sytn NNTP-Posting-Host: 89.8.67.159 References: <78fd99c3-538d-4981-af11-c1885df36575n@googlegroups.com> <7e2ece3d-893c-43fb-bf81-6002dbd0bc3dn@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <56dc220e-1341-4a9f-98cc-132c8afdc2afn@googlegroups.com> Subject: Re: [Ada95] Private non-generic children of generics not allowed From: Egil H H Injection-Date: Thu, 29 Apr 2021 11:02:01 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:61929 List-Id: 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)