Path: utzoo!news-server.csri.toronto.edu!rutgers!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: <27D7EA23.770@tct.uucp> Date: 8 Mar 91 19:46:42 GMT References: <71037@microsoft.UUCP> <27D57565.2B22@tct.uucp> <1991Mar7.153417.6489@linus.mitre.org> Organization: Teltronics/TCT, Sarasota, FL Lines: 31 According to dsr@mir.mitre.org (Douglas S. Rand): >IMHO you are not getting the requests [for a C++ isKindOf() feature] >from SmallTalk et al but from naive C programmers who have never >programmed using an OOP language before. Whatever my disagreements with Craig Hubley, I would never call him a "naive C programmer". On the other hand, it is true that the first instinct of a C programmer faced with C++ dynamic type loss -- i.e. he has a |Base*| and wants to do something specific to |Derived*| -- is to ask, "How can I find the _real_ type of the object?" So I would agree that inexperience in OOP usage can be one reason to desire isKindOf(). >> What they do not realize, however, is that C++ programming does not >> always admit of Smalltalk/Objective C/CLOS/etc. strategy. > >C++ strategy *is* Smalltalk/CLOS/Flavors strategy. They have much in common, yes. But static typing is a key difference between C++/Eiffel and Smalltalk/Objective C, because its use (as opposed to its toleration) requires strategies different from from those used in typeless languages. For example, Smalltalk allows the creation of generic |Collection| classes, whereas C++ strongly encourages the use of templates (or low-rent template emulations created with the preprocessor). -- 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