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) |
[36 later articles] |
From: | Dik.Winter@cwi.nl (Dik T. Winter) |
Newsgroups: | comp.compilers,comp.lang.misc |
Date: | 18 Mar 1997 12:54:18 -0500 |
Organization: | CWI, Amsterdam |
References: | 97-03-037 97-03-051 97-03-076 |
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.
Clear operator names help a lot and may even make the program clearer.
For instance, I once cooperated in the creation of a set of Algol 68
operators in numerical analysis. For instance, the integral from
0 to 1 of exp(x)^2dx with an absolute error bound of 1.0e-5 and a
relative error bound of 1.0e-6 would be written as:
c := 'range' (0, 1) 'integral' (('real' x) 'real': exp(x) ** 2)
'abserr' 1.0e-5 'relerr' 1.0e-6;
Adding "'method' gauss(10)" would modify it to a 10-point gaussian
integration.
Why is the first not clearer than (also in Algol 68)
c := integrate(0, 1, ('real' x) 'real': exp(x) ** 2, 1.0e-5, 1.0e-6)
which at least neads some comments to be made clear?
A good choice for the priorities is of course important. A bad choice
can be just as misleading as a badly chosen identifier.
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.