Re: Definable operators

Henry Spencer <henry@zoo.toronto.edu>
31 Mar 1997 15:32:59 -0500

          From comp.compilers

Related articles
[2 earlier articles]
Re: Definable operators fjh@murlibobo.cs.mu.OZ.AU (1997-03-18)
Re: Definable operators nmm1@cus.cam.ac.uk (1997-03-21)
Re: Definable operators henry@zoo.toronto.edu (Henry Spencer) (1997-03-22)
Re: Definable operators nmm1@cus.cam.ac.uk (1997-03-23)
Re: Definable operators fanf@lspace.org (Tony Finch) (1997-03-23)
Re: Definable operators Dave@occl-cam.demon.co.uk (Dave Lloyd) (1997-03-27)
Re: Definable operators henry@zoo.toronto.edu (Henry Spencer) (1997-03-31)
Re: Definable operators sethml@ugcs.caltech.edu (1997-03-31)
Re: Definable operators rivetchuck@aol.com (1997-04-02)
Re: Definable operators Dave@occl-cam.demon.co.uk (Dave Lloyd) (1997-04-02)
Re: Definable operators burley@gnu.ai.mit.edu (Craig Burley) (1997-04-03)
Re: Definable operators rideau@ens.fr (Francois-Rene Rideau) (1997-04-03)
Re: Definable operators leichter@smarts.com (Jerry Leichter) (1997-04-06)
[29 later articles]
| List of all articles for this month |
From: Henry Spencer <henry@zoo.toronto.edu>
Newsgroups: comp.compilers,comp.lang.misc
Date: 31 Mar 1997 15:32:59 -0500
Organization: SP Systems, Toronto
References: 97-03-037 97-03-115 97-03-141 97-03-162
Keywords: design, syntax

Our moderator writes:
>[Plus for string concatenation? Yuck. Too much tiny basic. More to
>the point, it's a poor choice since concatenation and addition are not
>the same thing. What does a+b mean if a is a string and b an int? ...


This is what my original "rule of thumb" posting was getting at. The
issue is not the original author's convenience; the issue is
readability and maintainability, with people other than the author
involved. (This is the difference between amateur and professional
programming.)


People can cope with plus used to mean addition on numbers, even odd
kinds of numbers, or things very similar to numbers. But when plus
sometimes means addition, and sometimes means string concatenation (a
very different operation, despite some limited similarities), trouble
is likely.


People can handle small doses of this kind of thing, particularly when
the operators are ones that aren't really very familiar as numeric
operators (e.g., ">>"). It's when you're tackling something difficult
that the extra mental complexity becomes a serious handicap.
--
| Henry Spencer
| henry@zoo.toronto.edu
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.