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-31 13:29:32 PST Newsgroups: comp.lang.ada Path: sparky!uunet!gatech!darwin.sura.net!wupost!cs.utexas.edu!sun-barr!ames!agate!linus!linus.mitre.org!linus!mbunix!eachus From: eachus@dr_no.mitre.org (Robert I. Eachus) Subject: Re: Classes vs Tagged Types - Terminology In-Reply-To: stt@spock.camb.inmet.com's message of Tue, 30 Mar 1993 14:34:46 GMT Message-ID: Sender: news@linus.mitre.org (News Service) Nntp-Posting-Host: dr-no.mitre.org Organization: The Mitre Corp., Bedford, MA. References: <17255@goanna.cs.rmit.oz.au> <1993Mar25.155650.16244@inmet.camb.inmet.com> <1993Mar30.143446.20879@inmet.camb.inmet.com> Date: Wed, 31 Mar 1993 20:46:38 GMT Date: 1993-03-31T20:46:38+00:00 List-Id: In article <1993Mar30.143446.20879@inmet.camb.inmet.com> stt@spock.camb.inmet.com (Tucker Taft) writes: > 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." Right way to bet, but you didn't take it far enough. :-) Seriously, it is very easy (well, easy for me anyway) to write a polymorphic list package in Ada 83, you can even have objects and parameters which would be of type T'CLASS in Ada 9X. The only problem is that you have to "hand write" the dispatching which occurs when you actually try to do something with a value of a class-wide object. However operations on class wide values whose return values are not of a specific element type are no problem. I could post a toy example here, but if anyone is interested I wrote something very similar for processing DIANA trees. (It didn't even use generics.) Since most of the dispatching was in the body of the package (and generated by a tool, I'm no glutton for punishment) it reduced the size of the code using the package by an order of magnitude or so over a non-abstract type. Don't get me wrong, the addition of tagged types in Ada 9X will make a lot of things easier, and will provide a lot of functionality not in Ada 83. It's just that polymorphic data structures have always been "in there." Using them has just never become a normal part of the Ada culture. -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...