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.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7251fa99aab97e06 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1993-03-16 17:32:44 PST Newsgroups: comp.lang.ada Path: sparky!uunet!widget!jgg From: jgg@evb.com (John Goodsen) Subject: Re: Encapsulation in Ada vs. C++ (Was Re: Ichibah [sic] ...) Message-ID: <1993Mar16.223708.11893@evb.com> Organization: EVB Software Engineering, Inc. Date: Tue, 16 Mar 1993 22:37:08 GMT Date: 1993-03-16T22:37:08+00:00 List-Id: magnus@lglsun.epfl.ch (Magnus Kempe) writes: > >If your class Foo grants "friendship" to a function/class Bar, _anyone_ >can write such a function/class and, having granted itself "friendliness", >will have access to the internals of Foo. > Oh my! And shame, shame, shame on you for even thinking imitating my "BAR". This argument is remeniscent of the facist arguments which have the common theme of "you might use it wrong, therefore I want to keep you from using it at all". BTW, you won't get too far in the link stage with both "BAR"s in the system (multiply defined identifiers and such..) > >To repeat: contrary to Ada, C++ does not provide a safe means to create >subprograms acting on parameters of two or more types (classes). In >C++, either you write an unsafe class because the language lacks the >concept of a module, or you twist around with .h files and say good-bye >to limited, separate recompilations. > "UNSAFE CLASS" ??? Huh? Come now! "friendship" is not necessarily unsafe. Only if you use it wrong. True, Ada packaging and "classtypes" (I refuse to use tagged type syntax anymore ;-) overcome this *perceived* defect in C++, but to *twist* the truth in suggesting that you lose separate recompilations is not responsible. In fact to the contrary, the *friend* concept allows for separate recompilation of these related classes and functions. Ada packages *REQUIRE* recompilation of all related "classtypes" (there it is again, isn't it a pretty syntax ;-), since they're in the same package. -- John Goodsen Software Process & Environments EVB Software Engineering jgg@evb.com