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,d10596e187e90822 X-Google-Attributes: gid103376,public From: Richard D Riehle Subject: Re: Private Children Date: 1999/06/23 Message-ID: <7krq1m$m2@dfw-ixnews5.ix.netcom.com>#1/1 X-Deja-AN: 493135600 References: <7klja3$c0p$1@nnrp1.deja.com> <376E70A5.F77E558D@averstar.com> <376E9EEB.322A3F39@averstar.com> <7kmoe4$o83@dfw-ixnews15.ix.netcom.com> <7kr4pc$bb9@dfw-ixnews15.ix.netcom.com> <7kra6p$t5h$1@remarQ.com> Organization: Netcom X-NETCOM-Date: Wed Jun 23 6:19:18 PM CDT 1999 Newsgroups: comp.lang.ada Date: 1999-06-23T18:19:18-05:00 List-Id: In response to my example of opaque types in Ada, In article <7kra6p$t5h$1@remarQ.com>, "Vladimir Olensky" wrote: >There is very interesting article about using M3 opaque types. It was >published in Dr.Dobb's journal >in October 1995 and now it is available online at >http://www.research.digital.com/SRC/modula-3/html/partial-rev/index.html The article you cited by Steve Freeman is certainly a thoughtful and fair treatment of some of the issues related to interface inheritance versus implementation inheritance. It is especially potent in highlighting some of the drawbacks of C++, but I doubt any C++ users from the Dr. Dobbs readership paid serious attention to that. In Mr. Freeman's Ada example, he assumes that the private part of the package must contain a complete view of the data. That is exactly the opposite of the example I posted earlier. In Ada, we can declare an incomplete type, an access to that type, enclose within a tagged record a value of the access type, and defer the full description of the data until later. This is the essence of an opaque type. Opaque types are convenient in both Ada and Modula-3 because of their clear separation of interface module (package specification) from implementation module (package body). This is more difficult in Java, C++, and even Eiffel, as demonstrated in Mr. Freeman's article. Although the Ada opaque type must be implemented using an access type, it does overcome one of the complaints Mr. Freeman has about Ada's structure: changes can be made to the full data definition, the implementation, in the package body without changing the interface. I agree that the use of an Ada access type to design an opaque type is not quite as elegant as the semantics of the Modula-3 REVEAL keyword. However, it is effective, clean, efficient and expressive enough to permit a an opaque type design that distinguishes implementation inheritance from specification inheritance. Richard Riehle richard@adaworks.com http://www.adaworks.com