Personal dialects and C++ overloading

brnstnd at stealth.acf.nyu.edu brnstnd at stealth.acf.nyu.edu
Fri Feb 16 15:32:49 AEST 1990


In article <4301 at daffy.cs.wisc.edu> schaut at cat9.cs.wisc.edu (Rick Schaut) writes:
> In article <926.18:17:58 at stealth.acf.nyu.edu> brnstnd at 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.

Say what? Why not? What if GLORPs and FOOBIEBLETCHen are natural
candidates for addition? And since when does the compiler decide this
for you?

Read my comments in another article in this thread about how to make
overloading readable.

> | 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.

The same would be true if overloading were distinctively marked, by an
initial character, for example. This would save gratuitous syntax errors
without being too distracting.

Even so, are you sure that vector + vector means addition and not
concatenation? Or are they character vectors, being used as strings?
As many other programmers have pointed out, you should never force
someone to learn a new language just to read a program.

---Dan



More information about the Comp.lang.c mailing list