peterh@otc.otca.oz (Peter Holdaway) (06/30/91)
I am just wondering if I am alone in thinking that C++ has become popular more because it is perceived of as the next upgrade of ANSI C rather than because it is an OO application language ? Coming from a Smalltalk background I often hear people telling me how type unsafe Smalltalk is compared to C++. Yet it appears to me that C++ has its own typing problems. First of all is the lack of runtime typing, be it as a belt and braces error checking mechanism or for persistent objects, but this has been discussed many times before. Of more concern to me is the hidden typing of an Object due to its memory allocation mechanism, especially since the programmer rather than the compiler must have intimate knowledge of the differences. A reference to an Object != an Object on the Stack != an static Object != an Object on the Heap != an Object in an Array of Objects. Add to this the fact that the programmer can use a pointer to any of the above and it becomes clear why writing library classes becomes a chore, and reusable libraries a nightmare. Now I realize that this is due to the C origins where memory allocation control was needed for low level Operating System functions, but it makes C++ the equivalent of an Object Orientated Assembler or perhaps an OO compiler compiler language rather than an OO applications language. I would not be surprised to find out that many are using C++ as an ANSI C compiler which happens to have a few canned classes like streams and a few collection classes. At the other extreme are the 10 page macros, templates and recipes that one must follow to add classes to large applications. Examples of this are libg++, NIHCL and Interviews where the result is effectively a dialect of C++ which is difficult to use with other dialects. This is not to say I would use C instead of C++. Back in 1984 I wrote my own OO preprocessor that produced C code that I was arrogant enough to call cplus. In 1991 I find I am doing the same thing except I don't have to write the messaging code, and the syntax looks cleaner (obscurer ?). I am not sure there has been much improvement. I am still looking for a good OO applications language.