Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!rutgers!uwvax!daffy!cat9.cs.wisc.edu!schaut From: schaut@cat9.cs.wisc.edu (Rick Schaut) Newsgroups: comp.lang.c Subject: Re: Personal dialects and C++ overloading Message-ID: <4301@daffy.cs.wisc.edu> Date: 15 Feb 90 03:03:44 GMT References: <5940014@hpcupt1.HP.COM> <33889@ucbvax.BERKELEY.EDU> <1922@gmdzi.UUCP> < <1990Jan29.210357.366@eng.umd.edu> <90029.194640JI8@PSUVM.BITNET> <4152@helios.TAMU.EDU> <926.18:17:58@stealth.acf.nyu.edu> Sender: news@daffy.cs.wisc.edu Distribution: usa Organization: U of Wisconsin CS Dept Lines: 33 Regarding overloading of operators: In article <926.18:17:58@stealth.acf.nyu.edu> brnstnd@stealth.acf.nyu.edu (Dan Bernstein) writes: | This Ada (and, by imitation, Fortran 90 and C++) misfeature makes | program maintenance a nightmare. The problem isn't just that it's a pain | to locate the routine that adds a GLORP to a FOOBIEBLETCH. The problem | is that you won't even notice the nonstandard usage until it's too late. Any compiler that would allow you to apply the "+" operator to a "GLORP" and a "FOOBIEBLETCH" doesn't conform to the notion of overloading. Overloading does _not_ come at the expense of strong type checking. It _does_, however, allow the programmer to apply the abstract notion of "addition" to objects for which such an operation makes sense (e.g. sets). Of course overloading the "+" operator to mean set difference when the two operands are sets doesn't make much sense in the semantics of any language. Does passing an array of characters in a parameter that is supposed to be a pointer to a FILE object make much sense? | Overloading saves typing time. It has no other advantages. (Is it an | advantage to be able to code without thinking and make undetectable | syntax errors?) Overloading saves having to think about the mechanics of calling the correct procedure whilst allowing the programmer to think more about the semantics of the program. It's not a case of being able to code without thinking. Rather, it's a case of being able to code while thinking about that which is important. -- Rick (schaut@garfield.cs.wisc.edu) Peace and Prejudice Don't Mix! (unknown add copy)