Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!oddjob!mimsy!cvl!elsie!nih-csl!keith From: keith@nih-csl.UUCP (keith gorlen) Newsgroups: comp.lang.misc,comp.lang.smalltalk,comp.lang.c++ Subject: Re: C++ vs Objective-C Message-ID: <274@nih-csl.UUCP> Date: Sat, 26-Sep-87 13:40:00 EDT Article-I.D.: nih-csl.274 Posted: Sat Sep 26 13:40:00 1987 Date-Received: Tue, 29-Sep-87 07:24:52 EDT References: <3405@ece-csc.UUCP> <638@its63b.ed.ac.uk> <1811@watcgl.waterloo.edu> <1406@pdn.UUCP> Organization: NIH-CSL, Bethesda, MD Lines: 67 Summary: If you need support for O-OP in C now, Objective-C may be for you. If you have the luxury of time to plan, go with C++. Xref: mnetor comp.lang.misc:695 comp.lang.smalltalk:336 comp.lang.c++:466 In article <1406@pdn.UUCP>, ken@pdn.UUCP (Ken Auer) writes: > In article <270@nih-csl.UUCP>, keith@nih-csl.UUCP (keith gorlen) writes: > > C++ features such as strong type checking and references make it > > a better C for those not doing O-OP... > > True, but why use either if you are not going to be using O-OP? You would use C++ if you don't need O-OP because it is an improved C. > > ...Features such as classes, > > function and operator overloading, user-controlled implicit type > > conversion, and guaranteed initialization/finalization make it far > > better for programming with abstract data types than Objective-C or > > Modula-2, for example. And derived classes and virtual functions make > > C++ as good or better than Objective-C for O-OP. > I believe I detect a bit of bias in this statement. Absolutely! In 1985 I set about looking for a language to do O-OP in C. I evaluated C/Flavors, Objective-C, and C++. I went to one of PPI's seminars (which I recommend), purchased a set of Objective-C reference manuals, and read Cox's book (which I also recommend, but the info on C++ is not correct). My choice was to go with C++ because it was the best designed language and I felt that it would win out in the long run. > To name just one feature that is missing from C++, Objective-C has the concept > of "class methods" (i.e. Classes are treated like objects). C++ also doesn't have I/O because "you can program that yourself" with the features the language does have. I wrote a fundamental Smalltalk-80 -like class library for C++ that is very similar to what the Objective-C class library was like circa 1985. It has a class Class, derived from class Object so that class descriptions can be manipulated like objects. It's not quite as good as Objective-C's, but good enough for most practical purposes and probably more efficient. > I don't know about you, but most of the work I do has to be done in the > present and not in the future. You are right. I happen to have the luxury of time to plan for the (not so distant) future. > One last point (take it or leave it) is that if/when C++ has the "symbolic > debugger and the extensive, mature, supported class library that Objective-C > has" now, what additional features might Objective-C have. Objective-C might have multiple inheritance, dynamic linking and garbage collection some day, but I doubt that it will ever have the non-O-OP features of C++. Speaking of extensive class libraries, I just read that IBM is placing C-MU's Base Environment 2 (BE2) class library in the public domain, to be distributed with the December release of X Windows. BE2 is the most impressive class library I've seen in action. It is written in Class, yet another C preprocessor that adds O-OP support to C. From the sketchy preliminary documentation I've read, it appears to do a cleaner job than Objective-C, though not as good as C++. One powerful feature it has is dynamic linking. Maybe someone who knows something about Class can jump in the fray. I'd love to be able to use the BE2 class library from C++ -- talk about HEAVEN! -- Keith Gorlen phone: (301) 496-5363 Building 12A, Room 2017 uucp: uunet!mimsy!elsie!nih-csl!keith National Institutes of Health Bethesda, MD 20892