Newsgroups: comp.lang.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: Personal dialects and C++ overloading Message-ID: <1990Feb9.181111.24546@utzoo.uucp> Organization: U of Toronto Zoology 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> Date: Fri, 9 Feb 90 18:11:11 GMT In article <926.18:17:58@stealth.acf.nyu.edu> brnstnd@stealth.acf.nyu.edu (Dan Bernstein) writes: >Overloading saves typing time. It has no other advantages... Sorry, I can't go along with that. Saving typing time by itself is not of massive importance, but shorter programs are. Other things being equal, a shorter program is easier to understand, easier to work with, easier to modify. The gotcha is in that phrase "other things being equal". In the case of operator overloading, other things are equal only if the author has been careful to follow the Law of Least Astonishment when writing the program. Operator overloading is a power tool. One does not give power tools to children and expect safe use, but for professionals they make work quicker and easier and thus make harder jobs manageable. The problem is that there are too many incompetent amateurs -- calling themselves programmers -- who will slice off their own fingers, or their successors' fingers, if given access to power tools. Unfortunately, it's also true that some power tools are safer than others. There is room for debate about whether C++'s sharp edges are dangerously exposed. Operator overloading is desirable and useful, but placing some more constraints on it might be desirable. -- SVR4: every feature you ever | Henry Spencer at U of Toronto Zoology wanted, and plenty you didn't.| uunet!attcan!utzoo!henry henry@zoo.toronto.edu