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: jsa@alexandria (Jon S Anthony) Subject: Re: Ada95 OOP Questions Date: 1996/08/21 Message-ID: #1/1 X-Deja-AN: 175705943 sender: news@organon.com (news) references: <3219EFDE.7161@cmass.com> organization: Organon Motives, Inc. newsgroups: comp.lang.ada,comp.lang.modula3 Date: 1996-08-21T00:00:00+00:00 List-Id: In article <3219EFDE.7161@cmass.com> Farshad Nayeri writes: > Eric Newton said: [...] > > 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. [...] > 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. This is done in Ada95 by use of child packages and/or use of constrained generics. In fact, it is "cake" and one of the primary uses of these constructs. > 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. Well, I read the article and I note that since Freeman does not mention how this sort of stuff is quite easily done in Ada, perhaps he does not understand the Ada model. He does a very good job with C++. In fact, at the first M3 (Association) example, he only mentions the problems that C++ or Eiffel would have in so "subtyping". Neither problem is applicable to Ada. /Jon -- Jon Anthony Organon Motives, Inc. 1 Williston Road, Suite 4 Belmont, MA 02178 617.484.3383 jsa@organon.com