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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d10596e187e90822 X-Google-Attributes: gid103376,public From: Richard D Riehle Subject: Re: Private Children Date: 1999/06/22 Message-ID: <7kmoe4$o83@dfw-ixnews15.ix.netcom.com>#1/1 X-Deja-AN: 492331818 References: <7klja3$c0p$1@nnrp1.deja.com> <376E70A5.F77E558D@averstar.com> <376E9EEB.322A3F39@averstar.com> Organization: Netcom X-NETCOM-Date: Mon Jun 21 8:21:08 PM CDT 1999 Newsgroups: comp.lang.ada Date: 1999-06-21T20:21:08-05:00 List-Id: In article <376E9EEB.322A3F39@averstar.com>, Tucker Taft wrote: >Oops, right you are. The "idiom" I was misremembering was actually to >create an extra level in the hierarchy, with all of the public >children made into public children of this intermediate level, >with the intermediate level spec having only a private part. >You could then use library unit renaming to hide the presence >of this intermediate level, if you wanted to. I believe Robert >Eachus suggested this approach originally. > >E.g.: > package P.Hidden_Level is > private > ... -- private stuff > end; > > package P.Hidden_Level.C1 is > ... > private > ... -- can see private decls of P.Hidden_Level > end; > > with P.Hidden_Level.C1; > package P.C1 renames P.Hidden_Level.C1; > >-Tuck Thanks Tucker. This is a good idea. Also, consider, package P.Hidden_Level.Public_Level is type some-type is tagged private; -- some publicly exported services private ... end P.Hidden_Level.Public_Level ; package body P.Hidden_Level.Public_Level is -- implement exported services using the -- private services in the hierarchy since -- the body can see the private declarations -- of parent its units. end P.Hidden_Level.Public_Level; Might be a good technique for creating a cascade of child packages where most of the hierarchy will consist of private specifications. The end of the hierarchy would be a public specification with a body implemented using those private specifications. This could prevent premature use of a well-formed set of decompositions while still modeling several levels of abstraction. I wonder if this is also useful with Tucker's earlier example of dispatching on privately declared operations. Seems there are some good possibilities for powerful design strategies in this idea. Richard Riehle richard@adaworks.com http://www.adaworks.com