From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:a0c:eb42:: with SMTP id c2mr6103889qvq.241.1578519679155; Wed, 08 Jan 2020 13:41:19 -0800 (PST) X-Received: by 2002:a9d:6557:: with SMTP id q23mr5523837otl.368.1578519678910; Wed, 08 Jan 2020 13:41:18 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!g89no1300188qtd.0!news-out.google.com!w29ni322qtc.0!nntp.google.com!g89no1300186qtd.0!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 8 Jan 2020 13:41:18 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=146.5.2.231; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 146.5.2.231 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <1aa6c82f-5f13-4319-86e9-5464ae8d92c7@googlegroups.com> Subject: Re: decomposing large packages From: Shark8 Injection-Date: Wed, 08 Jan 2020 21:41:19 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:57807 Date: 2020-01-08T13:41:18-08:00 List-Id: On Wednesday, January 8, 2020 at 8:56:48 AM UTC-7, mario.b...@gmail.com wrote: > > Now procedure n must be visible from inside package P. How can I accomplish that? RENAMES. ------------------- -- P (Spec) package P is type thing is ... procedure m (value : in thing); procedure n (value : in thing; temp : in natural); end package P; ------------------- -- S1 (Spec) package S1 is procedure n (value : in thing; temp : in natural); end package S1; ------------------- -- P (Body) with S1; package body P is procedure m (value : in thing) is ... procedure n (value : in thing; temp : in natural) renames S1.n; end P; > I played with child units but did not get what I wanted. The parent P unit must see the procedures and functions of the child units P.S1, P.S2, ... but the compiler complains that procedure n is not defined for type thing in P. Here's how you CAN do something like that, given the above specs: ------------------- -- P.Sn (Spec) Procedure Sn(value : in thing; temp : in natural); ------------------- -- P (Body) with P.Sn; package body P is procedure m (value : in thing) is ... procedure n (value : in thing; temp : in natural) renames P.Sn; end P; > Thanks for your help in advance. One thing you could do here is nested+separate units. Given ------------------- -- P (Spec) package P is type thing is ... procedure m (value : in thing); procedure n (value : in thing; temp : in natural); private -- Internals could be moved to the top of P's BODY. package Internals is procedure m (value : in thing); procedure n (value : in thing; temp : in natural); end Internals; end P; ------------------- -- P (Body) package body P is procedure m (value : in thing) renames Internals.m; procedure n (value : in thing; temp : in natural) renames Internals.n; package body Internals is separate; end P; ------------------- -- P.Internals (Body) -- File p-internals.adb Separate (P) Package Body Internals is procedure m (value : in thing) is Begin -- implementation. null; End m; procedure n (value : in thing; temp : in natural) is Begin -- implementation. null; End n; End Internals;