Path: utzoo!utgpu!watmath!clyde!att!pacbell!ames!sgi!arisia!quintus!ok
From: ok@quintus.uucp (Richard A. O'Keefe)
Newsgroups: comp.lang.misc
Subject: Re: aGREeable features (was Re: Algol-68 down for the count)
Message-ID: <796@quintus.UUCP>
Date: 2 Dec 88 08:57:23 GMT
References: <406@ubbpc.UUCP> <3688@hubcap.UUCP> <2070@garth.UUCP>
Sender: news@quintus.UUCP
Reply-To: ok@quintus.UUCP (Richard A. O'Keefe)
Organization: Quintus Computer Systems, Inc.
Lines: 48

In article <2070@garth.UUCP> phipps@garth.UUCP (Clay Phipps) writes:
>The fact that a language feature is enough of a challenge to understanding
>that it can be used as the basis of a test question is "evidence" to me
>that the feature may be more of a liability than an asset.

Yeah!  Let's get rid of assignment statements!
Better not forget procedures, too.		1/2 (:-)

>My recollection is that call-by-name was included in Algol 60
>to simplify implementation of some numerical analysis algorithm
>like the Runge-Kutta[sp?] or Newton-Raphson (these are *not* my field),
>yet it was made the default parameter transmission method.

Completely bogus.  You may be thinking of a neat hack called
"Jensen's device" which in effect gave you lambda-expressions:

	real procedure sum(l, u, i, x);
	    value l, u;
	    integer l, u, i;
	    real x;
	    begin
		real s;
		s := 0.0;
		for i := l step 1 until u do s := s + x;
		sum := s
	    end;
	...
	real array a[1:N], b[1:N];
	integer k;
	...
	dot product := sum(1, N, k, a[k]*b[k]);

Nope.  The origin of pass-by-name semantics is explained very clearly
in the Algol-60 report.  It follows very naturally indeed from the
"substitution" method used to explain procedure calls, which was
meant to be like lambda calculus:  first rename all the variables in
the body of the procedure, then substitute the actual parameters for
the formal parameters.  Value parameters are hard to explain this way.
In this case, what you get is
	begin integer I1, I2; real R1, R2;
	    I1 := 1; I2 := N; R1 := 0.0;
	    for k := I1 step 1 until I2 do R1 := R1 + a[k]*b[k];
	    R2 := R1;
	    dot_product := R2
	end;
After a few examples like this, pass-by-name becomes very simple to
grasp.  The *consequences* of pass-by-name are another matter, but
precisely the same objections can be raised against aliasing.