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.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.109.56.52.37.mobile.3.dk!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: Privacy and child packages (Was: Teaching C/C++ from Ada perspective?) Date: Sat, 07 Jul 2018 10:48:06 +0200 Organization: JSA Research & Innovation Message-ID: <87601rmny1.fsf_-_@adaheads.home> References: <856189aa-fa00-4960-929e-174f352310ad@googlegroups.com> <18554067-1382-4b43-a832-2d27aa5117d7@googlegroups.com> <8dc19505-b68a-403c-a164-f1de1864f3f1@googlegroups.com> <559657f8-bbf4-4a70-9449-f85bc98d6c6b@googlegroups.com> <590d4672-4aef-42a5-823c-57ccd291115a@googlegroups.com> <8de6b5ba-25ab-4d46-b80c-1544f43a9b05@googlegroups.com> <670baa25-a987-45a0-991f-ec3aa2878233@googlegroups.com> <6acaa855-2508-49cc-a03f-16c6e00c91da@googlegroups.com> <87h8lcuesk.fsf@nightsong.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: franka.jacob-sparre.dk; posting-host="109.56.52.37.mobile.3.dk:109.56.52.37"; logging-data="14388"; mail-complaints-to="news@jacob-sparre.dk" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:RyS+6jvZFGypHHT6Yf4Pl4vwnKc= Xref: reader02.eternal-september.org comp.lang.ada:53717 Date: 2018-07-07T10:48:06+02:00 List-Id: Micronian Coder writes: > Jean-Pierre beat me to it, but I concur that child packages is Ada's > answer to C++ friend. I find child packages much better than C++ > friend because you can keep adding additional subprograms, say for > testing purposes, without ever touching the original package. Yes. But the down-side(?) is that a clever programmer can use a child package to leak private information from its parent. You can see the package GNAT.Sockets.Compatibility in for an example. In this case I used it to be able to use the same input/output operations for both network connections and regular files. Greetings, Jacob -- 'I don't think you can fight a whole universe, sir!' 'It's the prerogative of every life form, Mr Stibbons!'