Re: Definable operators

nmm1@cus.cam.ac.uk (Nick Maclaren)
21 Mar 1997 10:10:53 -0500

          From comp.compilers

Related articles
Problems with Hardware, Languages, and Compilers hrubin@stat.purdue.edu (1997-03-07)
Re: Definable operators (was: Problems with Hardware, Languages, and C rrogers@cs.washington.edu (1997-03-13)
Re: Definable operators (was: Problems with Hardware, Languages, and C andy@cs.Stanford.EDU (1997-03-16)
Re: Definable operators Dik.Winter@cwi.nl (1997-03-18)
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)
[34 later articles]
| List of all articles for this month |

From: nmm1@cus.cam.ac.uk (Nick Maclaren)
Newsgroups: comp.compilers,comp.lang.misc
Date: 21 Mar 1997 10:10:53 -0500
Organization: University of Cambridge, England
References: 97-03-037 97-03-051 97-03-076 97-03-112
Keywords: design

andy@cs.Stanford.EDU (Andy Freeman) writes:
>>Yes, I think that definiable operators are worse than poorly chosen
>>value reference names. Definable operators share the "what is that?"
>>property of poorly chosen names, but they also have a "what is it
>>operating on?" problem.


Fergus Henderson <fjh@murlibobo.cs.mu.OZ.AU> wrote:
>In languages such as Haskell and Prolog, which both allow alphabetic
>character sequences in operators, there is no reason why operators
>need have the "what is that?" property of poorly chosen names.
>And the "what is it operating on" problem is usually easily
>resolved by looking at the operator declaration.


I am afraid that isn't true if you allow user-defined association
properties (i.e. associativity, commutativity, priority and overloading).
In order to work out what is going on, the user must at least be able to
parse the expression, which is why Algol 68 had the priority a property
of the operator SYMBOL and not the operator DEFINITION.


The key is to add operator definitions in a limited, well-defined and
clean fashion.


>>Frankly, I see no "large" potential benefits.


>Have you ever tried to write a combinator parser without using infix
>operators?


It also makes certain programs (such as many numerical ones) a couple of
orders of magnitude easier to follow. Consider some of the statistical
and numerical formulae that take half a page of A4 in matrix notation.
And now write those without using matrix operators :-(


Nick Maclaren,
University of Cambridge Computer Laboratory,
New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
Email: nmm1@cam.ac.uk
Tel.: +44 1223 334761 Fax: +44 1223 334679
--


Post a followup to this message

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