Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!ihlpf!nevin1 From: nevin1@ihlpf.ATT.COM (00704A-Liber) Newsgroups: comp.lang.c++ Subject: Re: Operator overloading considered harmful Message-ID: <3418@ihlpf.ATT.COM> Date: 19 Jan 88 02:09:49 GMT References: <240@vsi1.UUCP> <8180001@nucsrl.UUCP> <2607@calmasd.GE.COM> <265@vsi1.UUCP> Reply-To: nevin1@ihlpf.UUCP (00704A-Liber,N.) Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 32 In article <265@vsi1.UUCP> steve@vsi1.UUCP (Steve Maurer) writes: . . The thing that troubles me most about Operator overloading is that .definitions of basic operations, once static, are now contextual depending .upon the values of the particular programmer who wrote the header definition .code. This is _by no means_ "bad" programming practice, but simply the .inherent method by which you must use Operator overloading. And I believe, .after seeing similar do it yourself language design schemes (in Forth and .Structured Macro Assembly), that it can become the single greatest .obstruction to maintenence and portability of any program Why is this problem any different then having undocumented function calls in C? .Instead, lets take for example... 2 dimentional arrays. .What shall we define for them? Does '+' mean "combine into a 4 .dimentional array", "add each seperate element together, depositing .the results in a 2x array", or "give me the sum total of all these .numbers" ? Does '*' indicate multiplication? Or does it mean take .the dot product? What does '/' do?? The answers are quite system .(or program) dependent. Would a function addmatrix(array1, array2) mean "combine into a 4 dimensional array", "add each separate element together, depositing the results in a 2x array", or "give me the sum total of all these numbers", etc., etc. Without proper documentation, code is not maintainable. Period. It has nothing to do with overloading of operators. -- _ __ NEVIN J. LIBER ..!ihnp4!ihlpf!nevin1 (312) 510-6194 ' ) ) "The secret compartment of my ring I fill / / _ , __o ____ with an Underdog super-energy pill." / (_