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=ham 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-31 02:00:16 PST From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: Need advice re package organization. Date: Thu, 31 Jul 2003 11:04:59 +0200 Message-ID: References: <3F228F3B.9020203@attbi.com> <3F22F9E9.3040307@attbi.com> <5jn9ivoetll1fu2avn9hmjj6aaa7q7pmjn@4ax.com> NNTP-Posting-Host: tar-alcarin.cbb-automation.de (212.79.194.111) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1059642013 23977010 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!freenix!feed.ac-versailles.fr!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail Xref: archiver1.google.com comp.lang.ada:41062 Date: 2003-07-31T11:04:59+02:00 List-Id: On Wed, 30 Jul 2003 17:00:00 -0400, "Warren W. Gay VE3WWG" wrote: >Dmitry A. Kazakov wrote: >> Such subroutines could be viewed as an >> equivalent to C++'s "private methods". What Ada does not have are >> private data members in C++ sense. So we have: >> >> protected in C++ <--> private in Ada >> private method <--> a subroutine in the body [a FAT plus to Ada ] >> private member <--> missing [a minus] > >I think you need to add a dimension to this "chart", because >there are multiple (at least 2) views: > > 1. simple client view > 2. a _normal_ child package view > > (a _private_ child's view is the same I think, but if not, this > is a 3rd). > >The problem I am trying to address, is #2. The child package sees >all, even when you don't want it to. But if you do not want to see private things, then the package should not be a child. ----------------------------------------- However I should admit that there is a problem, not only in Ada, but it other OO languages too. It is a "philosophic" problem: "When implemening a method should I favour private or public interface?" Note that this problem exists even for a single package / class. Let I have a public Getter for some hidden member, should I use it instead of accessing the member directly implementing some other method? There is no definite answer to this, but in what a language (Ada) could help is in a clear separation of both. As a raw idea, one could have public and private parts of the package body. Or alternatively, one could have up to two bodies, private and public: package [private] body A is -- I see everything -- All dirty stuff goes here end A; package public body A is -- I see only the public part -- I need not review this body as long as the public part -- remains unchanged end A; --- Regards, Dmitry Kazakov www.dmitry-kazakov.de