Re: Definable operators

Matthew J. Raw <raw@math.wisc.edu>
16 Apr 1997 00:20:18 -0400

          From comp.compilers

Related articles
[12 earlier articles]
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)
Re: Definable operators dlester@cs.man.ac.uk (1997-04-16)
Re: Definable operators fanf@lspace.org (Tony Finch) (1997-04-18)
Re: Definable operators monnier+/news/comp/compilers@tequila.cs.yale.edu (Stefan Monnier) (1997-04-18)
Re: Definable operators burley@tweedledumb.cygnus.com (Craig Burley) (1997-04-18)
Re: Definable operators apardon@rc4.vub.ac.be (1997-04-20)
Re: Definable operators genew@vip.net (1997-04-20)
[20 later articles]
| List of all articles for this month |
From: Matthew J. Raw <raw@math.wisc.edu>
Newsgroups: comp.compilers
Date: 16 Apr 1997 00:20:18 -0400
Organization: Compilers Central
References: 97-03-037 97-03-076 97-03-112 97-03-115 97-03-141 97-03-162 97-04-018 97-04-034
Keywords: syntax, design

Jerry Leichter <leichter@smarts.com> wrote:
> No mathematician would, in mathematical usage, *ever* use + for string
> concatenation, for a very simple reason: "+" and related symbols (+ in
> a circle, capital sigma for repeated plus) are used for many different
> operations in different contexts, but always (OK, almost always - I
> can't think of an exception, but I'm sure *someone* will come up with
> one!) for *commutative* operations.


Ordinal numbers are the order types of well-ordered sets. The sum of
two ordinals is the order type of the concatenation of the two order
types; it is not a commutative operation (although it does match
integer addition for finite ordinals).


> (Interestingly, the other Algol68 convention - n*s meaning n copies of
> the string s - is somewhat better founded: It's common to think of the
> integers "acting on" some arbitrary structure. If there's an additive
> operation, using n*o for o+o+...+o - n copies - is pretty natural and
> reasonably widely used. On the other hand, no one would write o*n!)


The product of linear orders A*B is formed by replacing each element
in B with a copy of A; if n is an order with n elements (the first n
should be in boldface), then A+A+...+A - n copies - is A*n. This is
not generally the same as n*A; omega+omega = omega*2 <> 2*omega.


Gannon and Horning ("Language Design for Programming Reliability",
IEEE Transactions on Software Engineering, Vol SE-1, No. 2, June 1975)
conclude that traditional operator precedence is less error prone than
the APL style, and that infix relation connectors are also error
prone. On the other hand, the infix logical operators were actually
bitwise operators, and the test subjects had little experience with
APL and widespread experience with languages with traditional
precedence. Is there any more recent experiment to answer such
questions?


In the absence of further actual studies, this seems to be a religious
issue like placement of semicolons (Gannon and Horning conclude that
semicolon as statement terminator is better).
--
Matthew Raw
raw@math.wisc.edu
--


Post a followup to this message

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