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, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e5eb8ca5dcea2827 X-Google-Attributes: gid103376,public X-Google-Thread: 1008e3,a7084fcfbc5ce2fb X-Google-Attributes: gid1008e3,public From: Robert Dewar Subject: Re: Ada OO Mechanism Date: 1999/05/30 Message-ID: <7is7lu$91l$1@nnrp1.deja.com>#1/1 X-Deja-AN: 483835823 References: <7i05aq$rgl$1@news.orbitworld.net> <7i17gj$1u1k@news2.newsguy.com> <7icgkg$k4q$1@nnrp1.deja.com> <3749E9EC.2842436A@aasaa.ofe.org> <7id2eo$fag@drn.newsguy.com> <3749FF7D.F17CE16A@aasaa.ofe.org> <374AC676.F7AE0772@lmco.com> <374F1DD3.64070C3E@mitre.org> <7ircia$ued@drn.newsguy.com> X-Http-Proxy: 1.0 x24.deja.com:80 (Squid/1.1.22) for client 166.72.81.91 Organization: Deja.com - Share what you know. Learn what you don't. X-Article-Creation-Date: Sun May 30 20:39:26 1999 GMT Newsgroups: comp.lang.ada,comp.lang.modula3 X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-05-30T00:00:00+00:00 List-Id: In article <7ircia$ued@drn.newsguy.com>, chris@nospam wrote: > Today I saw a book on modula-3. > > I think Ada OO should have been designed as modula-3 OO is. > > So, here we have a language, which I thought was very similar > to Ada, but used the familiar class like construct for the OO > type. > I have no idea why Ada did not do it the same way. I wonder if > when Ada95 OO was designed, if modula-3 was around? Yes, of course it was. The thing to realize is that the design of Ada 95 is the way it is not because someone didn't think of something, but on the contrary because a lot of people thought a whole lot. The key point in Ada is to provide orthogonal features that can be used for many purposes. Some of these features are modularity, information hiding, procedural abstraction, type extension, inheritance and dynamic dispatching. Yes, it is possible (and convenient) to use these for various object oriented paradigms, but they are more general than this, and are designed to be convenient to use in more general circumstances. For instance, take the example I mentioned, if you define an algebra of operations on elements with operations such as addition, then it makes good sense to use the notions of tagged types, extensible types, inheritance and dynamic dispatching to provide a definition that can be extended, e.g. a more complex algebra can be developed which adds a multiplication operation. Now all this is expressible very nicely in Ada (I leave it as an easy, though not trivial, excercise to write the code), but it really does not make any sense to think of addition as a method which sends messages to the elements thought of as objects. This is a forced viewpoint that might have to be used in other languages, but definition will not be helpful in modeling an algebra, where the notion is a functional one, rather than a procedural one with objects. Note that in this case, the elements have no state, they are just values. Indeed you can take an entirely applicative view of this construction in Ada without the slighest sense of procedural thinking. Given that the notion of object is all about state and sending messages that interact with this state, objects are really quite inappropriate for this particular application. In particular, this example cannot be programmed nearly as neatly in Modula-3. Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't.