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 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bf2f30a0886f0d6c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1993-03-30 06:43:17 PST Newsgroups: comp.lang.ada Path: sparky!uunet!noc.near.net!inmet!spock!stt From: stt@spock.camb.inmet.com (Tucker Taft) Subject: Re: Classes vs Tagged Types - Terminology Message-ID: <1993Mar30.143446.20879@inmet.camb.inmet.com> Sender: news@inmet.camb.inmet.com Nntp-Posting-Host: spock Organization: Intermetrics Inc, Cambridge MA References: <17255@goanna.cs.rmit.oz.au> <1993Mar25.155650.16244@inmet.camb.inmet.com> Date: Tue, 30 Mar 1993 14:34:46 GMT Date: 1993-03-30T14:34:46+00:00 List-Id: In article 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