Re: Definable operators

Dave Lloyd <Dave@occl-cam.demon.co.uk>
2 Apr 1997 16:08:59 -0500

          From comp.compilers

Related articles
[6 earlier articles]
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)
Re: Definable operators hrubin@stat.purdue.edu (1997-04-11)
Re: Definable operators nmm1@cus.cam.ac.uk (1997-04-16)
Re: Definable operators raw@math.wisc.edu (Matthew J. Raw) (1997-04-16)
[26 later articles]
| List of all articles for this month |

From: Dave Lloyd <Dave@occl-cam.demon.co.uk>
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.


Regards,
----------------------------------------------------------------------
Dave Lloyd mailto:Dave@occl-cam.demon.co.uk
Oxford and Cambridge Compilers Ltd http://www.occl-cam.demon.co.uk/
Cambridge, England http://www.chaos.org.uk/~dave/
[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.