Path: utzoo!news-server.csri.toronto.edu!rutgers!uwm.edu!cs.utexas.edu!uunet!pdn!tscs!tct!chip From: chip@tct.uucp (Chip Salzenberg) Newsgroups: comp.lang.c++ Subject: Re: asking an object for its type Message-ID: <27DBD4B1.5972@tct.uucp> Date: 11 Mar 91 19:04:17 GMT References: <71037@microsoft.UUCP> <27D57565.2B22@tct.uucp> <1991Mar8.073356.25207@gpu.utcs.utoronto.ca> Organization: Teltronics/TCT, Sarasota, FL Lines: 73 According to craig@gpu.utcs.utoronto.ca (Craig Hubley): >In article <27D57565.2B22@tct.uucp> chip@tct.uucp (Chip Salzenberg) writes: >>Lots of Smalltalk, Objective C, CLOS, etc. programmers are converting >>to C++, and they are looking for language features like those of their >>previous languages ... > >...people who are already using these other OO languages are already >building reusable code libraries, and there is comparatively less >experience with building such libraries in C++. We might want to >listen to them tell us what they need. I don't know CLOS, but neither Smalltalk nor Objective C include any notion of static type, while static type is one of the fundamental principles of C++. I see no reason to believe that the Smalltalk and Objective C communities see in C++ anything but a pale imitation of the "real" OOPLs they know and love. I, on the other hand, see their total lack of type safety as a fundamental stumbling block for attempts to write reliable software. In a few words: I'll take C++, with static typing and difficult inheritance, over Smalltalk/Objective C, with no static typing but easier inheritance, any day of the week. This chasm of static typing is, IMHO, an insurmountable obstacle for any attempted transfers of reuse techniques between Objective C/Smalltalk and C++. >If the only answer on "how to do it" coming from the C++ community is >"add it as a virtual in the base class". I agree with the author who >called this "laughable". From the perspective of binary-reusable libraries, >anyway. Please remember that "reuse" is not synonymous with "inheritance". >Since C++ is the production language of choice for those building PROTOTYPES >in Smalltalk and CLOS, at least, allowing easy conversion of components >between these languages and C++ is an ongoing problem. If a project will eventually be written in C++, prototyping in Smalltalk is error #1. >I see it happening in dozens of organizations right now... Then they have fallen victim to error #1. :-) >Such opposition appears to be political: you don't want the language >"hijacked" by "outsiders" by which you appear to mean people who aren't >doing everything in C and liking it. I understand why my statements might sound that way. In fact, there's nothing political about my stand. It's a technical issue for me. It's an application of the principle of of information hiding. The C++ type system is capable of choosing among member functions based on dynamic type. Therefore, there is no reason to reveal the dynamic type. The consumer of an object should not be able to discover the exact type of that object; it doesn't have a "need to know." >Prototyping in other OO languages and shipping in C++ is a fact of life. So is COBOL. Who cares? >So is the desire for (and corporate commitment to) extend class hierachies >without source access. At least a lot of firms are planning to waste big >money trying, if waste it is. I look forward to observing the results of such attempts; perhaps I will learn something. But if the only means possible for achieving this goal is the use of isKindOf(), then I consider such projects to be technical failures before they have even begun. -- Chip Salzenberg at Teltronics/TCT , "Most of my code is written by myself. That is why so little gets done." -- Herman "HLLs will never fly" Rubin