Xref: utzoo comp.lang.c++:1868 comp.sys.next:472 Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!elroy!jpl-devvax!beowulf!david From: david@beowulf.JPL.NASA.GOV (David Smyth) Newsgroups: comp.lang.c++,comp.sys.next Subject: Re: Objective-C vs C++ Message-ID: <3438@jpl-devvax.JPL.NASA.GOV> Date: 31 Oct 88 21:48:44 GMT References: <8335@nlm-mcs.arpa> Sender: news@jpl-devvax.JPL.NASA.GOV Reply-To: david@beowulf.JPL.NASA.GOV (David Smyth) Organization: Jet Propulsion Laboratory, Pasadena, CA. Lines: 42 In article <8335@nlm-mcs.arpa> garl@nlm-mcs.arpa (Gary Letourneau) writes: > > Now that Objective-C is being bundled with the NeXT machine, I would like >to pose the following question: how does Objective-C compare with C++. This is going to cause some discussion, and I think that is what the net is for. Therefore, I'm posting to the net rather than e-mail as was suggested. At USENIX/C++, I said that C++ is too complex. Much recent net discussion has added support to this claim. C is basically simple (declarations and operator precedence are awful, of course). C++ is incredibly complex. The number of caveats which productive C++ programmers must grasp is simply too large: must have virtual destructors, can't have virtual constructors (makes sense, but it is obscure); when one must use [] on delete, and when they are not needed; only use multiple-inheritance when you have the source of all classes back to their roots because a client can introduce bugs which a C++ compliler won't catch; etc. etc. etc. I am not convinced that Objective-C is a good way to go: lack of strong typing for example. However, it is certainly a MUCH smaller addition to C than C++. Face it: the only reason we are talking about using C++ or Objective-C is because of a desire to be "upwardly compatible" with existing C code. Note, however, that C++ IS NOT "upwardly compatible" with C, rather C++ IS A DIFFERENT LANGUAGE! Just try including , and you will see what I mean. Or any large C language program! It won't compile with a C++ compiler. The more recent enhancements to the language continue to widen, rather than narrow, the difference in semantics between C++ and C. Since people are willing to use C++ anyways, perhaps what we should REALLY do is create a new, GOOD object language, and call it, say, ++C, and use it instead. Besides, the name would then be semantically correct! :-) I think it was and is a good idea for any new language to generate C as an assembly language, like cfront does. True, a C compiler cannot make some optimizations which a C++ compiler can make, because some semanitcs are lost in the translation. This is usually not significant to early implementations based on a prototype language anyway.