Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!morocco!landauer From: landauer%morocco@Sun.COM (Doug Landauer) Newsgroups: comp.lang.misc,comp.lang.c++ Subject: Re: C++ vs Objective-C Message-ID: <28774@sun.uucp> Date: Tue, 22-Sep-87 17:21:31 EDT Article-I.D.: sun.28774 Posted: Tue Sep 22 17:21:31 1987 Date-Received: Fri, 25-Sep-87 01:39:35 EDT References: <3405@ece-csc.UUCP> <638@its63b.ed.ac.uk> <1811@watcgl.waterloo.edu> <1971@tekig5.TEK.COM> Sender: news@sun.uucp Reply-To: landauer@sun.UUCP (Doug Landauer) Organization: Sun Microsystems, Mountain View Lines: 62 Xref: mnetor comp.lang.misc:678 comp.lang.c++:446 >> == Doug Moen > == Tom Milligan >>Objective-C is apparently C with Smalltalk code embedded using escape >>sequences. The problem is that when you program in Objective-C, you >>have to deal with two universes: the C universe, and the Smalltalk universe. To be more fair, the embedded Smalltalk-like code in Objective-C is embedded within C by using statements surrounded by brackets; new classes and methods by statements beginning with +, -, or =. And you can cross between the universes -- so it's more like two offices, down the hall from one another, than two universes. > ... This is syntax only though. Beneath all of it, >though, BOTH ARE C not "C and Simula", or "C and Smalltalk". The notion that >in Objective-C you have to deal with "Smalltalk objects" and/or "C objects" >and that this makes things un-unified is bogus. There are only C structures >in both C++ and Objective-C. By the same token, there are *no* C structures, only collections of bits; and assembly language is just as powerful as both C++ and Objective-C, and they're all just as powerful as a Turing machine. Now that *is* bogus. (True, in a way, but bogus nonetheless.) Just because most current implementations of both of these languages are compiled into C doesn't make them equivalent to C from the programmer's point of view. What makes this "syntax only" difference important to me is that the additional features of C++ (over C) are invoked using syntax that looks like the rest of C, while the object-oriented parts of Objective-C look like they were grafted on. >>C++, on the other hand, is a single unified language. >>Classes are a straightforward extension of structures. This means >>you can take an existing C structure definition, and simply add >>methods to it, without invalidating existing code that uses the structure. >>In Objective C, you would presumably have to translate the structure >>definition into Smalltalk, and change all the code that used the structure >>into Smalltalk code. > >Once again, bogus. No, this is not bogus; in fact, it is one of the primary differences between the two languages: C++ "looks like C", and Objective-C looks like "C with embedded Smalltalk statements". Objective-C requires a different incantation to perform an object-oriented message-send than to call a function. C++ doesn't. >In summary, both languages have what it takes to be an object-oriented >language. Objective-C uses a Smalltalk-based syntax and C++ uses something >akin to Simula syntax. Well, something derived from the Simula syntax, but which actually looks more like C than it looks like Simula. >As for which language is better, well, I let others more knowlegable than >myself hash that one out. Neither language is "better" for everyone. Some prefer C++, some prefer Objective-C. Hell, some people still prefer Forth, APL, COBOL & FORTRAN! -- Doug Landauer Sun Microsystems, Inc. ARPA Internet: landauer@sun.com Software Products Division UUCP: {amdahl, decwrl, hplabs, seismo, ...}!sun!landauer