Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!eecae!netnews.upenn.edu!rutgers!bellcore!texbell!sw1e!uucibg From: uucibg@sw1e.UUCP (3929]) Newsgroups: comp.lang.c++ Subject: Re: Smalltalk-80 like inheritance in C++ possible ? Message-ID: <1421@sw1e.UUCP> Date: 24 Mar 89 21:31:54 GMT References: <110@honold.UUCP> <5481@rlvd.UUCP> <1411@sw1e.UUCP> <9174@claris.com> Reply-To: uucibg@sw1e.UUCP (Brian Gilstrap [5-3929]) Organization: Southwestern Bell Telephone Co Lines: 75 In article <9174@claris.com> hearn@claris.com (Bob Hearn) writes: >In article <1411@sw1e.UUCP> uucibg@sw1e.UUCP (Brian Gilstrap [5-3929]) writes: >>The biggie is of course the fact that C++ uses strong typing of objects (e.g. >>determine at compile time what function/method is to be invoked ) while >>Smalltalk and Smalltalk-like languages use weak typing of objects and actually >>accomplish function address resolution at run-time. The net result of this is > >Well, yes, but you *do* have virtual functions in C++, which give you most >of the functionality you want. ... [ One *seriously* archaic though (as near as I can tell) quite accurate ] [ description ] >So, if I cast the ptr to member function of derived class to a ptr to member >function of base class, where the base class has virtual functions, then >it works! Ta da. Aren't you glad you read this all the way to the end? :-) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ yes. :-) >Bob Hearn >hearn@claris.com Your comments do bring up several points, which I would like to *DISCUSS* if anyone else is interested. There has already been too much bashing of various kinds lately, and I do *not* want to start a religious war. So if you feel particularly strongly about what I say here, send me private email (and I can quietly dump the flames :-) but Please don't flame back to the group. I find, the more I deal with C++, the more concepts I have deal with. For me, worrying about whether a base class contains virtual functions or not in order to assure appropriate selection of a function based upon member function pointers is rather hairy. Yes, I can figure out what's going on. Do I want to? Not really. If I have to spend all my time worrying about these kinds of things, then I won't get any work done. I certainly realize that there is a learning curve to C++. But It seems that there's *so* much to learn. I was my understanding that the whole purpose of OOP was to make life easier on programmers overall. It certainly requires a great deal more design time than functional programming, but in the long run will (we hope) save us lots of hassle. However, I don't see that happening in C++ yet. It seems to be getting more and more complex. I recently read Bjarne Stroustrup's article in the latest issue of JOOP about parameterized types in C++. It boggled my mind. Sure I figured out what he was talking about, and yes I could decipher the code. But it's all so complicated with so many exceptions that it begins to seem like it's not worth the effort to learn. This seems especially true when I start to look at other OOP languages which have grafted Smalltalk classes/objects onto C (note that Objective-C is not the only one). In these cases, you have to learn one particular extension to C and then you're done with the new concepts. Another point (and I'm going to go way out on a limb here): it seems like the concept of objects is made rather complex by the use of static/strong typing. This is what get's you into all the issues of virtual functions and parameterized types. Yes, I realize that weak typing introduces its own problems. But I'm beginning to conclude that the weak-typing problems are easier to deal with than the strong-typing ones. I do realize that C++ was intended to improve C in many ways, just one of which was object-oriented-ness. I also realize that Bjarne Stroustrup also wanted to keep C++ as efficient as possible (in the spirit of C). I think that it's a very admirable idea. However, it seems that the cost we pay for all that possible efficiency is complexity. I'm not sure that the efficiency gained will really be worth it (though there will of course always be applications which push the limits). Please respond rationally. 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