comp.lang.ada
 help / color / mirror / Atom feed
From: bertrand@hub.ucsb.edu (Bertrand Meyer)
Subject: Re: Inheritance and Ada
Date: 25 Dec 87 20:28:10 GMT	[thread overview]
Message-ID: <255@hub.ucsb.edu> (raw)
In-Reply-To: 1673@ppi.UUCP


	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

  reply	other threads:[~1987-12-25 20:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1987-12-16 20:32 Inheritance and Ada Ephraim Silverberg
1987-12-17  3:47 ` Steven D. Litvintchouk
1987-12-24 15:47   ` Brad Cox
1987-12-25 20:28     ` Bertrand Meyer [this message]
1987-12-28  0:52       ` Steven D. Litvintchouk
1987-12-28  3:21     ` Litvintchouk
1988-01-05 20:27     ` Chris Henrich
1988-01-06 20:36       ` David E. Emery
1988-01-07 13:58       ` Kari Syst{
  -- strict thread matches above, loose matches on Subject: below --
1987-12-28 15:38 Mike Feldman
1987-12-29 15:28 ` Richard Pettit
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox