Article View: comp.lang.misc
Article #5599Re: What makes a language "easy" to program in?
From: Erland Sommarskog
Date: Mon, 13 Jun 1988 21:47
Date: Mon, 13 Jun 1988 21:47
41 lines
1778 bytes
1778 bytes
Richard Harter (g-rh@CCA.CCA.COM.UUCP) writes:
> As a side point, this examples illustrates a comon deficiency
>in programming languages -- they force the user to specify too much.
>What is wanted in this case is really something like
> for i in {0,...,n-1} a[i] = 0;
>or
> for all i in range of a, a[i] = 0;
>or even
> a = 0;
> The point is that the quoted forms specify too much, and too
>little. They specify too much in that they specify the details of the
>calculation, and too little in that the desired result is not explicit,
Spot on it! This concrete example gets better in Ada:
FOR i IN a'range LOOP a(i) := 0; END LOOP;
Or better:
a := (OTHERS => 0);
The ultimate winner is VAX-Pascal, though:
a := zero;
The predefined function zero can be used to clear any array or record.
It should be added that although Ada helps you in many cases, it is
too verbose for the purposes desired here. (VAX-Pascal, monster of
Pascal as it may be, is insufficient in many other occassions.)
>The best programming language only has one instruction:
>
> "Do what I want"
Here's the pseudo-code for that compiler:
Read(Line);
Trim_and_compress(Line);
IF Line = "Do what I want" THEN
Write("But what do you want?");
ELSE
Write("Syntax error");
--
Erland Sommarskog
ENEA Data, Stockholm
sommar@enea.UUCP
Mail your NO votes for rec.music.rock to: jfc%Athena.mit.edu@mit-eddie.UUCP
Technical Details
Message-ID:
<3496@enea.se>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!enea!sommarShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!enea!sommar From: sommar@enea.se (Erland Sommarskog) Newsgroups: comp.lang.misc Subject: Re: What makes a language "easy" to program in? Message-ID: <3496@enea.se> Date: 13 Jun 88 21:47:30 GMT Organization: ENEA DATA AB, Sweden Lines: 40