Article View: comp.lang.misc
Article #1090Re: Scientists as Programmers (was Re: Small Language Wanted)
From: Stephen J Bevan
Date: Sun, 30 Aug 1992 17:25
Date: Sun, 30 Aug 1992 17:25
37 lines
2407 bytes
2407 bytes
In article <ARI.HUTTUNEN.92Aug30182130@hulk.hut.fi> Ari.Huttunen@hut.fi (Ari Juhani Huttunen) writes:
Yes, I would myself like to see these loop-constructs in Sather:
loop until <xxxx> loop while <xxxx> loop for <xxxx> to <yyyy> loop
<xxxx> <yyyy> <yyyy> <zzzz>
end end end end
IMHO the above are quite poor syntax for expressing the kinds of loops
that I see in numerical code. Quite often it is possible to work in
parallel, and all the above do is make it harder to extract the
parallelism (of course so does the FORTRAN notation, but there is not
reason to make the same mistake :-). In the cases where it is not
numerical, syntax like the above is often useless as it is usually
restricted so that you can only iterate over integer indices (cf
Oberon-2). Note some languages get this right and let you iterate
over whatever you want e.g. Eiffel and C (given Sather's parentage I
guess it does to)
Anyway, I think the following are "better" approaches :-
1. use a language that achieves the same effect in a "better" way
e.g. Haskell with list comprehensions or Lisp + loop macros /
series package.
2. use a language that allows you to extend the syntax yourself e.g.
Scheme and Lisp so that you can do whatever you want. There is
potential for getting this badly wrong, but as it takes someone
with a discerning taste to use Scheme/Lisp in the first place it
usually works out ok :-)
3. Have a special notation for numerical iteration (that covers the
4th example), and leave everything else to a generic 1 1/2 loop
e.g. "loop ... exit when ... end".
Of course, it is all just concrete syntax so who cares anyway :-)
bevan
Technical Details
Message-ID:
<BEVAN.92Aug30182505@tiger.cs.man.ac.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!math.fu-berlin.de!Germany.EU.net!mcsun!uknet!mucs!m1!bevanReferences:
<17opl4INN5gb@roundup.crhc.uiuc.edu> <17ov89INNdls@network.ucsd.edu> <ARI.HUTTUNEN.92Aug30182130@hulk.hut.fi>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!math.fu-berlin.de!Germany.EU.net!mcsun!uknet!mucs!m1!bevan From: bevan@cs.man.ac.uk (Stephen J Bevan) Newsgroups: comp.lang.misc Subject: Re: Scientists as Programmers (was Re: Small Language Wanted) Message-ID: <BEVAN.92Aug30182505@tiger.cs.man.ac.uk> Date: 30 Aug 92 17:25:05 GMT References: <17opl4INN5gb@roundup.crhc.uiuc.edu> <17ov89INNdls@network.ucsd.edu> <ARI.HUTTUNEN.92Aug30182130@hulk.hut.fi> Sender: news@cs.man.ac.uk Organization: Department of Computer Science, University of Manchester Lines: 37 In-reply-to: Ari.Huttunen@hut.fi's message of 30 Aug 92 16:21:30 GMT