comp.lang.ada
 help / color / mirror / Atom feed
From: stt@spock.camb.inmet.com (Tucker Taft)
Subject: Re: Classes vs Tagged Types - Terminology
Date: Tue, 30 Mar 1993 14:34:46 GMT
Date: 1993-03-30T14:34:46+00:00	[thread overview]
Message-ID: <1993Mar30.143446.20879@inmet.camb.inmet.com> (raw)
In-Reply-To: BEVAN.93Mar26110200@panda.cs.man.ac.uk

In article <BEVAN.93Mar26110200@panda.cs.man.ac.uk> 
  bevan@cs.man.ac.uk (Stephen J Bevan) writes:

>In article <1993Mar25.155650.16244@inmet.camb.inmet.com> 
>  stt@spock.camb.inmet.com (Tucker Taft) writes:
>   [ much that I agree with except for the following ]
>   More important than inheritance (even with type extension), 
>   in my view, is the ability to have multiple implementations of 
>   a given abstraction.  This is what separates an "object-oriented"
>   language (like Ada 9X or C++) from an "abstraction-oriented"
>   language (like Ada 83 or CLU).  In an "abstraction-oriented"
>   language, each abstraction interface has exactly one implementation,
>   and hence all calls on operations of the interface can be
>   statically bound.  
>
>One of my favourite languages, ML, allows multiple implementations of
>a single interface via parameterisation and to some extent so does
>Ada83 via generics.  Can this be reconciled with the above statement?

Good point.  However, a compile-time parameterized 
abstraction, as embodied by an Ada 83 generic, 
cannot provide the dynamic flexibility of the run-time
polymorphism of object-oriented languages, where each object
at run-time identifies its own underlying type.  For example,
try creating a heterogeneous linked list using Ada 83 generics.
You might be able to do it (I always hesitate claiming you *can't*
do something with generics with Robert Eachus around ;-), 
but it will be a lot of work and the result will probably 
not be as "user friendly."

With an object-oriented language, a heterogeneous list
is trivial, since a class-wide pointer can point to an object
of any type in a class of types, while each object in the list
identifies its own "creation" type.

On the other hand, Ada 83 generics provide parameterization
by type, so you can create *homogeneous* lists of any arbitrary
type more easily using a generic "list" abstraction.  
So the capabilities of run-time polymorphism inherent 
in an object-oriented language with "self-identifying" 
objects, and the capabilities of compile-time polymorphism 
inherent in generics (with parameterization by type), 
are complementary to one another.

In Ada 9X, we have actually enhanced the support for generics somewhat,
so as to ensure they work well in combination with tagged
types.  Originally, there were some who thought that generics
would become "passe'" once we added support for OOP, but,
as has been recognized by the designers of both C++ and Eiffel,
generics are still very useful for defining abstractions
that are parameterized by type.  Such abstractions typically 
represent some kind of "collection" (i.e., what is 
traditionally called a "data structure" ;-).

I don't know the full details of ML's support for parametric
polymorphism.  If the objects are self-identifying at run-time, then
I would consider it "object-oriented" in the above sense.
If not, implying that defining heterogeneous linked data
structures is more painful, then it is an "abstraction-oriented"
language based on the above definitions.

>bevan

S. Tucker Taft   stt@inmet.com
Ada 9X Mapping/Revisiont Team
Intermetrics, Inc.
Cambridge, MA  02138



  reply	other threads:[~1993-03-30 14:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-03-22 11:46 Classes vs Tagged Types - Terminology Charles Lindsey
1993-03-24  7:42 ` Richard A. O'Keefe
1993-03-25 15:56   ` Tucker Taft
1993-03-26 11:02     ` Stephen J Bevan
1993-03-30 14:34       ` Tucker Taft [this message]
1993-03-31 16:21         ` Stephen J Bevan
1993-03-31 20:46         ` Robert I. Eachus
1993-03-24  8:58 ` Robb Nebbe
1993-03-25  0:15   ` David Emery
1993-03-29  9:26     ` Robb Nebbe
  -- strict thread matches above, loose matches on Subject: below --
1993-04-05 15:54 John Goodsen
1993-04-05 23:04 ` Mark A Biggar
1993-04-06 16:36 Harry Koehnemann
1993-04-06 16:46 mcsun!julienas!newsserver!geant!bruniau
1993-04-07 13:49 pipex!uknet!warwick!zaphod.crihan.fr!univ-lyon1.fr!scsing.switch.ch!sicsu
replies disabled

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