[comp.arch] Algol, and language design

johnl@esegue.segue.boston.ma.us (John R. Levine) (07/26/90)

In article <58091@lanl.gov> jlg@lanl.gov (Jim Giles) writes:
>Well yes, ALGOL _has_ had an enormous _negative_ impact on language
>design (that still continues today).  Features like 'call-by-name' are
>now recognized as bad by nearly everyone.

Alan Perlis, who was on the Algol committee, once told me that when they
defined call-by-name, they thought they were defining call-by-reference
more elegantly.  When Jensen invented his now-notorious device and they
realized what they had created, they were as surprised as anyone.  Oops.

>In fact, only two features, that I can find, are original to ALGOL and
>have a continuing positive influence on language design: if-then-else
>and while().

How about nested scopes and recursion?  I find them handy from time to time.

I'd also be interested to hear what about compound statements (by which I
presume you mean BEGIN ... END blocks) is bad, and whether the Algol 68
approach in which every control structure has its own closing word, obviating
begin and end, is any better.

-- 
John R. Levine, Segue Software, POB 349, Cambridge MA 02238, +1 617 864 9650
johnl@esegue.segue.boston.ma.us, {ima|lotus|spdcc}!esegue!johnl
Marlon Brando and Doris Day were born on the same day.

cik@l.cc.purdue.edu (Herman Rubin) (07/26/90)

In article <1990Jul26.024449.1777@esegue.segue.boston.ma.us>, johnl@esegue.segue.boston.ma.us (John R. Levine) writes:
> In article <58091@lanl.gov> jlg@lanl.gov (Jim Giles) writes:
> >Well yes, ALGOL _has_ had an enormous _negative_ impact on language
> >design (that still continues today).  Features like 'call-by-name' are
> >now recognized as bad by nearly everyone.
> 
> Alan Perlis, who was on the Algol committee, once told me that when they
> defined call-by-name, they thought they were defining call-by-reference
> more elegantly.  When Jensen invented his now-notorious device and they
> realized what they had created, they were as surprised as anyone.  Oops.
> 
> >In fact, only two features, that I can find, are original to ALGOL and
> >have a continuing positive influence on language design: if-then-else
> >and while().
> 
> How about nested scopes and recursion?  I find them handy from time to time.

Nested scopes of DO loops are present in Fortran.  Mathematicians have used
recursion for ages, and the problems with implementing recursion in the
architecture of the time were horrendous.  Frankly, some of them still are.
What language allows carrying globals in registers across recursion?

One of the things which should be noted was that, at the time, registers
were few and transfer and memory access were relatively fast compared with
computation.  Nobody would have considered the above question of any
importance.  Self-modifying code was a necessity, and even a decade later,
the return jump (subroutine call) automatically did so.

> I'd also be interested to hear what about compound statements (by which I
> presume you mean BEGIN ... END blocks) is bad, and whether the Algol 68
> approach in which every control structure has its own closing word, obviating
> begin and end, is any better.

I do not see IF and FI as any better than BEGIN and END.  Better would be
to have labels (including temporary labels not going into the symbol table)
and end statements which would carry the label.  The END statement, even
without a BEGIN statement, was in common use at the time; All processors
need to know when to stop.

-- 
Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907
Phone: (317)494-6054
hrubin@l.cc.purdue.edu (Internet, bitnet)	{purdue,pur-ee}!l.cc!cik(UUCP)

ccc_ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) (08/07/90)

Has anybody else noticed that call-by-name makes a certain amount of
sense when you're expanding routine calls in-line?

Think of macros that expand to generated code (or perhaps some
intermediate form thereof), as opposed to more source code.

Lawrence D'Oliveiro                       fone: +64-71-562-889
Computer Services Dept                     fax: +64-71-384-066
University of Waikato            electric mail: ldo@waikato.ac.nz
Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+12:00
-- 
Send compilers articles to compilers@esegue.segue.boston.ma.us
{spdcc | ima | lotus| world}!esegue.  Meta-mail to compilers-request@esegue.

rwh@PROOF.ERGO.CS.CMU.EDU (Robert Harper) (08/07/90)

ccc_ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes:

>Has anybody else noticed that call-by-name makes a certain amount of sense
>when you're expanding routine calls in-line? Think of macros that expand to
>generated code (or perhaps some intermediate form thereof), as opposed to
>more source code.

John Reynolds certainly has: his new language, Forsythe, is call-by-name, and
the compiler makes heavy use of this property.  In fact, the default is to
open-code all procedures, with closed-coding forced only when recursion is
involved.
-- 
Robert Harper				
School of Computer Science		Net: rwh@cs.cmu.edu
Carnegie Mellon University		Phone: +1 412 268 3675
Pittsburgh, PA 15213
-- 
Send compilers articles to compilers@esegue.segue.boston.ma.us
{spdcc | ima | lotus| world}!esegue.  Meta-mail to compilers-request@esegue.