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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,900edaa189af2033 X-Google-Attributes: gid103376,public X-Google-Thread: 1008e3,8671b73b2d5c62b7 X-Google-Attributes: gid1008e3,public From: Farshad Nayeri Subject: Re: Ada95 OOP Questions Date: 1996/08/20 Message-ID: <3219EFDE.7161@cmass.com>#1/1 X-Deja-AN: 175447731 cc: farshad@cmass.com, kalsow@cmass.com, steve@cmass.com content-type: text/plain; charset=us-ascii organization: Critical Mass, Inc. mime-version: 1.0 newsgroups: comp.lang.ada,comp.lang.modula3 x-mailer: Mozilla 2.02 (Win95; I) Date: 1996-08-20T00:00:00+00:00 List-Id: Eric Newton said: > The point of the (deleted) example was to show that > a package is just a namespace, and that multiple classes > can live in that namespace, and that the features of > the class do not need to be visibly associated > with the dispatch object. Matrixes encapsulates > Matrix *and* Vector types. I can list the Matrix and > Vector operations willy-nilly within this namespace. > In C++/Modula-3 I must list the operations on > the private state of Matrix within the Matrix class. > I must list the operations on the private state of > Vector within the Vector class. > There is visible association of dispatch methods and type. While this may be true of C++'s, it is an inaccurate statement about Modula-3's organization of namespaces and visibility of class features. In fact, much care went into designing namespaces and avoiding problems in the C++ "public/private/protected/friend" model as you describe. Modula-3 has separate mechanisms for encapsulation (modules & interfaces) vs. inheritance and dispatching (object types). An implementor can define an interface which reveals partial information about one or more object types; clients can import only the necessary features by importing the interface that reveals the right kind of information about (one or more) types. Anyone with the right level of access to a group of classes, that is, anyone who imports the right "private" interface to a module, can access the private state of those classes as prescribed by the implementor of the interface. Steve Freeman has written a nice article for Dr. Dobb's Journal, comparing the encapsulation and grouping facilities of Ada95, C++, Eiffel, and Modula-3. He addresses precisely the kinds of issues that Eric mentioned and goes through code examples to illustrate his point. A copy of the article is available via the Modula-3 home page. http://www.research.digital.com/SRC/modula-3/html/ Regards, -- Farshad Disclaimer: I am biased! -- Farshad Nayeri Critical Mass, Inc. http://www.cmass.com/