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,efe03f20164a417b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-03-20 03:00:57 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!math.ohio-state.edu!jussieu.fr!univ-lyon1.fr!swidir.switch.ch!epflnews!dinews.epfl.ch!lglsun!nebbe From: nebbe@lglsun.epfl.ch (Robb Nebbe) Newsgroups: comp.lang.ada Subject: Re: An observation of Ada (may offend) Date: 20 Mar 1995 10:13:35 GMT Organization: Ecole Polytechnique Federale de Lausanne Sender: nebbe@lglsun3.epfl.ch (Robb Nebbe) Distribution: world Message-ID: <1995Mar20.103925@lglsun.epfl.ch> References: <3kbkm1$41o@miranda.gmrc.gecm.com> <3kcflv$164a@watnews1.watson.ibm.com> NNTP-Posting-Host: lglsun3.epfl.ch Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Date: 1995-03-20T10:13:35+00:00 List-Id: In article <3kcflv$164a@watnews1.watson.ibm.com>, ncohen@watson.ibm.com (Norman H. Cohen) writes: |> If there is a weakness in Ada encapsulation, it has nothing to do with |> parameter lists, but with the definition of "logically within the |> defining unit". Anyone can write a child package that is "logically |> within the defining unit". (Do-While Jones once called this the "Howard |> Hughes effect": strangers claiming to be your heirs.) Child units enjoy |> access analogous to that permitted for C++ protected members in a |> subclass of a definining class. Thus the strongest degree of hiding that |> Ada can provide is that of C++ "protected", not C++ "private". Hiding is an all or nothing proposition; either something is hidden or it isn't there is no "sort of hidden". Now you can differentiate the information hiding facilities of different langauges based in granularity, flexability, simplicity etc. IMHO "Protected" is a quirk of C++ stemming from the lack of orthogonality between modules and types. In other words you wind up compensating for the simplicity of the type=module approach by increasing the levels of visibility or adding features like nested classes and friend functions. It isn't at all clear that "protected" is desirable in a language. In Ada you can use whatever amount of information hiding you want through the various uses of packages and types. In general this can be accomplished by using child packages to provide specialized interfaces and allowing the client to choose what they need to see. In other languages the progammer is often required to forsee all possible uses of the abstraction or resort to complicated schemes using multiple inheritance to increase the flexibility of the solution. Robb Nebbe