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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,23cf9f1e93744eed X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-28 21:49:35 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!harp.news.atl.earthlink.net!not-for-mail From: Richard Riehle Newsgroups: comp.lang.ada Subject: Re: Need advice re package organization. Date: Mon, 28 Jul 2003 21:52:09 -0700 Organization: AdaWorks Software Engineering Message-ID: <3F25FD78.16C87D8D@adaworks.com> References: <3F228F3B.9020203@attbi.com> <3F22F9E9.3040307@attbi.com> <3F24900B.8020002@attbi.com> Reply-To: richard@adaworks.com NNTP-Posting-Host: 41.b2.61.a8 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Server-Date: 29 Jul 2003 04:49:34 GMT X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:40923 Date: 2003-07-29T04:49:34+00:00 List-Id: "Robert I. Eachus" wrote: > chris wrote: > > What is a private child package? > > private package Parent.Private_Child is... end Parent.Private_Child; > > See RM 10.1.1(12), and 10.1.2(8). Probably one of the best kept secrets > in Ada 95. A private child package can have a with clause for another > private child of the same parent (or ancestor package), but the real use > is that the body of the parent package or any sibling can with the > private package. One of the most ideas related to private children is the potential for aspect-oriented programming (AOP). The idea of cross-cutting common facilities across a larger design while preserving encapsulation is nicely accomplished with private chilren. > So if you have common utility routines that you don't want to make part > of the parent's package spec, put them in a private child. For example, > the parent package might export a private type, and the private child > could include the inquiry functions and other operations that needed to > see into the private part of the parent. This allows us to promote any feature of a package body to a private package specification. What this means is that the package body should only contain implementations in the specification. Any other functions or procedures should be declared in a private package specification. Once this is done, those specifications are themselves extensible. Also, every set of subprograms is declared at the specification level. Voila, we have a model for AOP. Of course, I do oversimplify in this description, but anyone who explores this in depth will soon discover the validity of this notion. Richard Riehle