Article View: comp.lang.misc
Article #3650Re: Dynamic typing (part 3)
From: Richard A. O'Keefe
Date: Wed, 24 Apr 1991 08:21
Date: Wed, 24 Apr 1991 08:21
37 lines
1806 bytes
1806 bytes
In article <1991Apr15.183805.10544@maths.nott.ac.uk>,
anw@maths.nott.ac.uk (Dr A. N. Walker) writes [about Algol 60]:
> In any case, dynamic
> *own* arrays are a pig to compile; again, they were [?universally]
> omitted from implementations.
If I remember correctly, Burroughs Algol supported them.
There never was any particular problem in compiling them;
the problem was in chosing from several interpretations of what
they should mean (not unlike C++, just like a head cold is not
altogether unlike the Plague). The interpretation which was
adopted for Algol 60.1 is that the bounds are determined the
first time that the declaration is elaborated, and don't change
after that. So
for n := 1, n + 2 while n < 13 do begin
own integer array a[1:n];
...
end;
would have the array declaration compiled to something like
static int already_done = 0;
static struct Int_1D a;
if (!already_done) {
a.lb1 = 1;
a.ub1 = n;
a.data = malloc((a.ub1-a.lb1+1) * sizeof *(a.data));
already_done = 1;
}
This is a pig to compile?
Of course, if the loop is
for n := 11, n - 2 while n > 0 do begin
own integer array a[1:n];
...
end;
then you may be in trouble ...
--
Bad things happen periodically, and they're going to happen to somebody.
Why not you? -- John Allen Paulos.
Technical Details
Message-ID:
<5388@goanna.cs.rmit.oz.au>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!spool.mu.edu!munnari.oz.au!goanna!okReferences:
<1366@optima.cs.arizona.edu> <1991Apr15.183805.10544@maths.nott.ac.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!spool.mu.edu!munnari.oz.au!goanna!ok From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) Newsgroups: comp.lang.misc Subject: Re: Dynamic typing (part 3) Message-ID: <5388@goanna.cs.rmit.oz.au> Date: 24 Apr 91 08:21:53 GMT References: <1366@optima.cs.arizona.edu> <1991Apr15.183805.10544@maths.nott.ac.uk> Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 37