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, MSGID_SHORT autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!mnetor!uunet!husc6!think!ames!sdcsvax!hub!bertrand From: bertrand@hub.ucsb.edu (Bertrand Meyer) Newsgroups: comp.lang.ada Subject: Re: Inheritance and Ada Message-ID: <255@hub.ucsb.edu> Date: 25 Dec 87 20:28:10 GMT References: <8712161858.AA06960@techunix.bitnet> <19902@linus.UUCP> <1673@ppi.UUCP> Organization: University of California, Santa Barbara Summary: Inheritance and genericity, or Ada vs. Object-Oriented Languages: A solution and its implementation List-Id: I just saw some of the recent discussion on inheritance and genericity. I am surprised none of the discussants quoted my article, ``Genericity versus Inheritance'', which addresses precisely this topic. The paper was published in the Proceedings of the first OOPSLA conference (OOPSLA 86, Portland; SIGPLAN Notices, 21, 11, pp. 391-405). A revised version is due for publication in the Journal of Pascal, Ada and Modula-2. I would be surprised if Dr. Brad Cox did not know the original paper. The article explores the relationship between Ada-like generic modules and inheritance as it exists in O-O languages. It shows the respective benefits of both techniques and explains how they have been (cleanly, I think) combined in the Eiffel language and environment. I was surprised to note that Dr. Cox mentioned Objective-C as a language bringing a solution to the problem. In an untyped language like Objective-C the notion of genericity does not even exist. Eiffel, in contrast, is a fully typed language, where the type system is based on (multiple) inheritance. Then genericity can be brought into the picture, as in e.g. class STACK [T] ... end which shows STACK to be parameterized by a type T. This way you can declare, say, an entity is: STACK [INTEGER] which is statically constrained to hold only integers. The call is.push ('A'), for example, will be rejected by the compiler as incorrect (the argument should have been an integer). This does not prevent data structures from being polymorphic: for example, if an entity is declared as fs: STACK [FIGURE] then you may push onto the corresponding object a point, a circle etc., assuming POINT, CIRCLE etc. are descendant classes (in the sense of inheritance) of FIGURE. However you may not push onto fs, say, an integer. This policy reconciles flexibility and dynamic binding with the need for a proper control over program reliability through static typing. All this and more has been implemented efficiently and is used by numerous organizations worldwide. There have been a number of publications on Eiffel and a book is forthcoming (Object-Oriented Software Construction, B. Meyer, Prentice-Hall, February 1988). Bertrand Meyer Interactive Software Engineering, Inc. 270 Storke Road, Suite 7 Goleta, CA 93117 (805) 685-1006