Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!milano!bigtex!texbell!sw1e!uucibg From: uucibg@sw1e.UUCP (3929]) Newsgroups: comp.sys.mac.programmer Subject: Re: LSC++? Message-ID: <1465@sw1e.UUCP> Date: 6 Apr 89 06:18:25 GMT References: <1791@viscous.sco.COM> <1330@husc6.harvard.edu> <7235@fluke.COM> <1405@sw1e.UUCP> <9166@claris.com> Reply-To: uucibg@sw1e.UUCP (Brian Gilstrap [5-3929]) Organization: Southwestern Bell Telephone Co Lines: 120 In article <9166@claris.com> hearn@claris.com (Bob Hearn) writes: >Hey, Brian, how's it going? I don't know much about Objective-C, but I've Just a quick personal note and then onward: Bob, it's going pretty well. However, i've tried to mail to you several times and it bounces. Drop me a line and we'll catch up. >........................... I don't know much about Objective-C, but I've >heard it's a dog, efficiency-wise, compared to C. ...................... Well, there is dynamic lookup of functions at runtime, which is more costly than dereferencing a pointer al a virtual functions. There is not doubt that C++ lets you program closer to the bleeding edge of the machine However, as part of their hype, Stepstone mentions that there are currently about 20 companies doing major development in Objective-C and that 15 or so are real-time applications. The message lookup is in assembly (one reason that Objective-C isn't on all that many platforms yet) and it's very optimized. This definitely means that there are applications for which C++ is more appropriate. However, I suspect that method lookup is actually very fast. All it involves is running a linked listed of pointers and doing some longint comparisons (all you speed freaks will run screaming I'm sure :-) Note also that Objective-C *does have static binding*. This means (as far as I know) that you can have the equivalent of virtual functions in Objective-C (and non-virtual ones as well). I can't be positive on this since I haven't looked into the static binding too deeply yet (waiting for a copy of the new manual and a chance to play with the new version of the compiler). >................................................. That it takes all the >SmallTalk ideas and forces them rather rudely into a C-like syntax. Is this >true? ................ I don't find that to be true at all. It certainly takes the Smalltalk ideas and grafts them onto C. Since C is basically portable assembly and object- orientedness is rather high-level, you do have a bit of an adjustment to make. Personally, I find it beats C hands down in the elegance and simplicity areas. >..... One thing I love about C++ is that it doesn't have to be (and in >fact in general isn't) any less efficient than C. ............ This is definitely true. However, Objective-C is only less so as far as weakly-typed object-oriented code is concerned. Objective-C is a superset of C so you only pay in speed when you send messages (you can code your methods intirely in vanilla C if you feel like it). Since it now has static binding, you actually get the best of both worlds. You can develop in a weakly typed environment which lets you prototype quickly and then go back and make the stuff statically typed to improve efficiency as needed. >................................................. The object-oriented >stuff is there, if you want it. You can even have classes and object >without any real (slow) message passing or dynamic type-checking, ........ same in Objective-C >................................................................, but then >virtual functions give you polymorphism if you need it, at a computational >cost no greater than if you did it the hard way with explicit table lookup. same in Objective-C, with the advantage of using dynamic lookup as needed and when speed is not critical (you know the saying about 80% of the time being spend in 20% of the code). >As for operator overloading... I love it. But it sure is easy to abuse. Yep. My sentiments exactly. >What do these other languages give you that C++ doesn't? ................ What it gives you: ----------------- dynamic lookup much greater polymorphism a simpler, more elegant semantics faster prototyping What it doesn't give you: ------------------------ operator overloading (something of a mixed blessing :-) the more flexible declaration locations anonymous unions (isn't this in ANSI C?) default function parameter values There are others that will depend upon your compiler being ANSI (since Objective-C is a translator front like cfront) such as function prototypes. >........................................................ And since C++ is >likely to become the new standard, once it gets well-enough defined, does >it matter? ............... Unfortunately, it probably doesn't matter. I say unfortunately because I'm not convinced that C++ is the way to go. NOTE! that I'm also not convinced that Objective-C is the way to go. However, I don't think that other object-oriented languages are getting fair evaluations in comparison to C++ (I wish I could get my hands on Eiffel, CLOS , and others). >.......... BTW... I've heard rumors of a second-edition Stroustrup. My >working references right now are Stroustrup and the papers he's written >since the book. Is this up to date? As you probably already know by now, cfront 2.0 has been announced. I haven't read the article in "Unix Today!" yet but it apparently includes multiple inheritance (and I would hope parameterized types). > >Bob Hearn >hearn@claris.com Well, everybody, jump on in, but please no flames. Thanks, Brian R. Gilstrap Southwestern Bell Telephone One Bell Center Rm 17-G-4 ...!ames!killer!texbell!sw1e!uucibg St. Louis, MO 63101 ...!bellcore!texbell!sw1e!uucibg (314) 235-3929 #include