Re: Definable operators

Dave Lloyd <>
2 Apr 1997 16:08:59 -0500

          From comp.compilers

Related articles
[6 earlier articles]
Re: Definable operators (1997-03-23)
Re: Definable operators (Tony Finch) (1997-03-23)
Re: Definable operators (Dave Lloyd) (1997-03-27)
Re: Definable operators (Henry Spencer) (1997-03-31)
Re: Definable operators (1997-03-31)
Re: Definable operators (1997-04-02)
Re: Definable operators (Dave Lloyd) (1997-04-02)
Re: Definable operators (Craig Burley) (1997-04-03)
Re: Definable operators (Francois-Rene Rideau) (1997-04-03)
Re: Definable operators (Jerry Leichter) (1997-04-06)
Re: Definable operators (1997-04-11)
Re: Definable operators (1997-04-16)
Re: Definable operators (Matthew J. Raw) (1997-04-16)
[26 later articles]
| List of all articles for this month |

From: Dave Lloyd <>
Newsgroups: comp.compilers
Date: 2 Apr 1997 16:08:59 -0500
Organization: Compilers Central
References: 97-03-037 97-03-076 97-03-112 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? ...

Nothing to do with basic. Algol 68 as part of its Standard Prelude
defined that "+" between strings concatenated them and just to annoy
you it also defined that "*" between an int and a string replicated
the string. These operators are simply defined by means available to
the programmer as well as language designer. There is no standard
definition for "+" between string and int in Algol 68.

Henry Spencer wrote:
> 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.

This is all fluff and waffle. Mathematicians often define addition
via concatenation (remember the good old successor function to induce
the integers?). They are the same basic operation - intuitively and
mathematically. Juxtaposition (REXX) or "//" are reasonable
alternatives, but strcat (a,b) which is what most of the world must
use is just gibberish!

Henry Spencer wrote:
> 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.

You have a very low opinion of the capabilities of your fellow
programmers. This is the same attitude that says most programmers are
incapable of understanding more than Fortran or C or Visual Basic or
Java. Either that or high school maths students have more mental
agility than your average programmer.

Dave Lloyd
Oxford and Cambridge Compilers Ltd
Cambridge, England
[If high school math students had to read, understand, and modify proofs
as big as your typical program, I suspect they'd have just as much trouble
with mutant notation. Like Henry said, small doses are OK, for large
programs, the more obvious the better. -John]


Post a followup to this message

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