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,7251fa99aab97e06 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1993-03-19 17:20:39 PST Newsgroups: comp.lang.ada Path: sparky!uunet!widget!jgg From: jgg@evb.com (John Goodsen) Subject: Re: In favor of tagged types (was Classes versus tagged types was Ichibah flames, and flames out over, Ada 9X) Message-ID: <1993Mar19.222836.2540@evb.com> Organization: EVB Software Engineering, Inc. Date: Fri, 19 Mar 1993 22:28:36 GMT Date: 1993-03-19T22:28:36+00:00 List-Id: <1993Mar18.172630@lglsun.epfl.ch> barbey@lglsun.epfl.ch (Stephane Barbey) writes: > > The OO terminology is not fixed. For instance, OOPLs use different terms >to designate: > >- the class from which another class is derived (Smalltalk: superclass, > C++: base class), > >- the structure of a class (CLOS: slot, Eiffel: attribute, Smalltalk: > instance variables, C++: member data elements, Ada 9X: components), > >- the subprograms that describe the behavior of an object (Eiffel: > routine, Smalltalk: method, C++: member function, Ada 9X: primitive > operations). > >- ... > > People use different terms for the same idea. (That's why we speak of >the tower of Babel of programming languages, don't we ? :-). Sometimes, >people use the same term for different ideas. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Exactly my point! :-) Talk to potential new users of Ada 9X in terms they *understand* and then explain how the Ada 9X "CLASS" is *better*, but don`t create an extra step by first educating newcomers on new and non-standard terminology like "tagged types" before you even get to the "my class is better than your class" discussion. > >Conclusion 1: There is no need for Ada 9X to adopt a given > OO terminology, because, to quote S. Tucker Taft, it is still > "a huge muddle now". > Bad conclusion. *EVERY* (respectable) OO language has the concept of CLASS and it is directly supported in the syntax of that language. > >: An object is a logical collection of state and functionality. >: (if you want to argue unfixed, let's argue the oft used but >: never defined 'logical collection' ) >: >: A class defines the commonality of a set of objects. > > There are objects in Ada, and their definition is in accordance with >your definition. However, what you call a class is commonly known as a >type. (A class is not only a type, but also provides encapsulation, >thus the equation class=module=type in Eiffel and other "pure" OOPLs). > > In languages like C, there was no support for encapsulation, and a >weak support for user-defined types (structs). In comparison, Ada 83 >offers packages, strong typing and type derivation. Therefore, there is >no need for a entirely new construct, say a "C++ like" class construct. >We just can re-use some of Ada 83's mechanisms. > > >Conclusion 2: you can have the equivalent of a C++ class in Ada 9X, > using some of the concepts of Ada 83 and some of the concepts > introduced in Ada 9X. > This is not too tough to conclude, and no one in their right mind will disagree. Again, for the nth time (reuse? :-) this is *NOT* the point! It is strictly a marketing issue. Don't use "tagged type" terminology. Use "class type" terminology, so that the marketing folks of Ada 9X will be on a level playing field as the competition. It is only a syntax modification to the current proposal. NO SEMANTIC CHANGES WHATSOEVER! > >As a consequence of reusability of concepts, it will be easier for the >users of Ada 83 to transition to Ada 9X and OO technology. > With both "tagged type" *AND* "class type" proposals, I might add. "Class types" will just make it easier for us to make inroads into NEW, repeat NEW markets, unless we'd rather just hang out in DoD land and see what mandated Ada 9X contracts come around.... >: >: > >: > That said, I have a lot of trouble with tagged. It's just a long- >: >held belief of mine that a language feature shouldn't even appear to be >: >suggesting its implementation. >: >: Here Here !!! >: (or is that hear hear ? See the problems you have >: when your semantics aren't fixed ? ) >: >: Thomas >: >: > >: > Charlie >: > > In both Ada 83 and Ada 9X, a class is a set of types with similar >values and operations. There are language-defined classes, for example >the class of integer types, and user-defined classes. You're making up terminology here. These are considered "types" in Ada XX. As far as I know, >there are no C++ terms to designate an Ada 9X class (maybe "hierarchy >of classes rooted at type T", although it is not satisfying). Moreover, >there are no way to control that an object belongs to a given class! > Huh? First you say they're Ada 9X doesn't have a class, and now you're calling them a class. Well, I don't blame you. EVERY OO Language should have some CLASS, and it sounds like underneath it all, you agree. > Since all objects in a class of types share properties (states and >behavior), it is convenient for the programmer to manage them in a >uniform way (thus the introduction of dynamic binding and class-wide >programming in Ada 9X). As we also want to be able to distinguish the >types of those objects, we need an information that tells what the type >of an object is at run-time, i.e. a tag. That's why Ada 9X calls the >types that can be put in a user-defined class tagged types. That's not >(only) suggesting their implementation : it affects their semantics as >well. > "class types" would be more user friendly and less threatening to the new Ada programmer (read: NEW MARKETS :-) > There are no tags in C++, and it causes lots of trouble with >heterogeneous data structures. Usually, you have to program the tag >yourself and do the dispatching (dynamic binding) by hand. > For example? Are you referring to the proposal for tagged pointers in C++ that was posted on comp.lang.c++ months ago? > >Conclusion 3: all in all, the adopted terms speak for themselves. As > long as you care to study it, the Ada 9X terminology is clear, > precise and makes clear what the introduced features are. > That's the point, once again: "AS LONG AS YOU CARE TO STUDY IT..." Face the facts. The world is full of lazy programmers. Make it easy for them to see the power. Don't force them to work at it or too many will just bypass it. Yes this is unfortunate, but it's reality. > >Therefore I support the "tagged type" and "class" terminology used in >Ada 9X. > Still? :-) -- John Goodsen EVB Software Engineering, Inc. jgg@evb.com - Ada & Object Oriented Training/Products (301) 695-6960 - Ada GUI & Graphics Tools and Training - Software Reuse, Process & Environments