Path: utzoo!mnetor!uunet!husc6!mit-eddie!uw-beaver!tikal!hplsla!jima From: jima@hplsla.HP.COM (jim adcock ) Newsgroups: comp.lang.c++ Subject: Re: Operator overloading harmful (good criticism, bad example) Message-ID: <6590003@hplsla.HP.COM> Date: 13 Jan 88 21:23:16 GMT References: <250@vsi1.UUCP> Organization: HP Lake Stevens, WA Lines: 59 > i = d[ a + b * c ]; > > What does it do? *** SIGH *** Hopefully, what it does is assign i the value of the (a plus (b times c))'eth element of d. If not, it was probably written by a brain dead programmer. Would you RATHER try to maintain a program consisting of thousands of lines of the following type of code ??? assign(i,index(d,sum(a,product(b,c)))); I've certainly seen PLENTY of code of the above variety, simply because MOST languages have NO OTHER WAY to express math formulas on anything more complicated than a floating point number. WHICH code do YOU believe is more likely to have the BUG in it in the FIRST place, the line of code using standard math symbols, or the line of code consisting soley of "prose" descriptions? WHICH code do YOU believe would be faster and easier to write? C++ allows standard mathematical intuition with regards to mathematical formulas to be applied to things more complicated than floating point numbers -- complex numbers, vectors, matrices, sparse arrays, etc, etc. -- I believe the goal of C++ is to allow GOOD programmers to write GOOD code -- In my experience, when you take inexperienced programmers, and put them onto a good language, MOST tend to rise to the occasion, and write code at the quality level that the language allows. I believe most programmers WANT to do a good job. It's the butting you head against a language that doesn't ALLOW good programming that leads to the bad code, because then programmers give up in frustration, and crank out any old style code. In any case, it will be good code, written by good programmers, that will tend to survive and propagate over the years, serving as example for future C++ programmers. Certainly, I share your fears that until a volume of C++ programs develop, such that the C++ community starts to form a natural consenses as to what represents "good" C++ programming style, until then there ARE going to be some pretty weird examples of people going off the deap end, using C++ features in some pretty bizarre ways. But I have no doubt that the C++ community will recognize these efforts for the garbage that they truly are. For me, a bigger concern than the people who might overload "+" to mean "So Fred, wanna havva pizza for lunch" are the people who are blindly trying to force C++ programming into a Smalltalk-like mold. I am far from convinced that the Smalltalk-style of object oriented programming truly represents the direction that the C++ community should head towards. [[I won't even MENTION what I think about people who hack cfront !!!]] "Fool-proof tools are only fit for use by fools"