Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!princeton!allegra!alice!shopiro From: shopiro@alice.UUCP Newsgroups: comp.lang.misc,comp.lang.c++,comp.lang.pascal Subject: Re: need info on C++ vs Object Pascal vs Objective C vs etc Message-ID: <7037@alice.UUCP> Date: Tue, 30-Jun-87 15:08:31 EDT Article-I.D.: alice.7037 Posted: Tue Jun 30 15:08:31 1987 Date-Received: Wed, 1-Jul-87 07:23:19 EDT References: <2016@sphinx.uchicago.edu> Organization: AT&T Bell Laboratories, Murray Hill NJ Lines: 108 Keywords: elegance popularity portability Summary: C++ apologia Xref: mnetor comp.lang.misc:482 comp.lang.c++:347 comp.lang.pascal:177 In article <2016@sphinx.uchicago.edu>, code@sphinx.UUCP writes: > I am interested in hearing about the relative merits of object oriented > programming languages. I am especially interested in languages that are > faster than Smalltalk but relatively standard. I have been working with C++ for the past several years. C++ is an object oriented language designed for people who would otherwise use C, but need more support for managing complexity, as well as a language for people who would otherwise use Smalltalk, but need a language that is faster and more portable (and also has the advantages of a compile-time type system). C++ is a nearly upward compatible extension of C, is available for a wide variety of machines under MS-DOS, UNIX, VMS, and other operating systems, and is in use at many (that is, thousands of) academic and commercial sites. > Some of my concerns: > > 1) C++ seems unnecessarily arcane to me. It seems to me to be too much > like C (terse, unfriendly, really-low-level) in the ways I prefer Pascal > (idealized). (Please, no C-vs-Pascal flames. I recognize > many strengths of C, but they're not as critical to me as to many others.) Although some people view the terse syntax of C as a deficiency, we like it. You may also find that some of C's ``low levelness'' has been mitigated by C++'s much stronger type checking. I'm not quite sure what you mean by unfriendly, but C++ programs can be much more declarative (as opposed to procedural) than C programs, and the compiler does a quite thorough consistency check, generating much better error messages than C. This helps a lot. C++ supports a wide range of programming styles, including the low level code that is typical of carefully tuned C programs. This is essential for some; you might prefer the data abstraction and object oriented styles that better utilize the C++ type system. > I would like to be able to truly dynamically bind methods > in a straightforward way. If you mean that you would like to dynamically link procedures into a running program, that is not implemented in the generally available implementations of C++. On the other hand, C++ supports the invocation of methods based on the (dynamically determined) type of the object very well. The syntax looks like C, the semantics is what you would expect (no surprises), and the cost of a method invocation is equal to the cost of an ordinary function call plus four memory references. > 2) Is Object Pascal good? I don't really have an opinion. It is Pascal. It runs on a Mac. It provides support for object-oriented programming (methods), but not for data abstraction (data hiding, operator overloading, etc.). It is simpler than C++, but then it isn't used for such a large range of applications on such a large range of systems as C++. > Is it available (or will it be soon) for machines other than the Macs? Will > it become a standard, or will it remain an Apple oddity? For what it is worth I can mention that Apple is adopting a subset of C++ called ``minimal C++'' as their C and that they are re-writing MacApp in C++. For details, ask Larry Tesler at Apple. > 3) Is anyone developing an interpreter for C++? This seems like the way > for C++ to go, if possible. (Then it might never be necessary to write a > true C++ compiler. Don't underestimate the C++ to C translator; it does a complete type check and uses a C compiler only as a code generator - it is not a simple preprocessor. However, AT&T does have a ``true compiler'' that produces assembler or object code for several machines without going through intermediate C. Others are producing such compilers too; next year you will have several (compatible) choices. > You could develop in an interpreter, and endure slow > translation-compilation when you were pretty much finished.) Would it be > particularly hard for somebody to write a C++ interpreter? C++ programs tend to be largely declarative, and a small change in a declaration can have pervasive effects on the code. I think it would be quite difficult to write a fast C++ interpreter, although I would be glad to be proved wrong. The way things are going seems be towards incremntal compilation that combines fast turn-around for debugging with strong type checking. > 4) How much momentum is there behind these languages (and others, like > Objective-C)? Is it time to get with it, or time to wait and see? I am > looking for a popular, portable language. C++ is certainly popular and portable. C++ is widely used both within and outside AT&T, and there is C++ development both within and outside AT&T. Some I can't talk about and most I don't know about. The number of projects must be in the thousands now. C++ will continue to improve in an upward compatible way, but if you are looking for an object oriented language to use now, and if portability or performance matters, I think C++ is the way to go. > 7) Are there any emerging standard interfaces between o-o languages and X? Using C libraries from C++ is quite straightforward. There certainly are people using things such as Xwindows and Microsoft windows from C++. There are no standards as yet. What have you read about C++? The C++ book? Papers? If you are interested I could send you a few recent papers. -- Jonathan Shopiro AT&T Bell Laboratories, Murray Hill, NJ 07974 research!shopiro (201) 582-4179