Article View: comp.lang.misc
Article #3825Re: Re: Algol68 (and standards diatribe)
From: Chris Dollin
Date: Mon, 13 May 1991 15:51
Date: Mon, 13 May 1991 15:51
61 lines
3701 bytes
3701 bytes
Dr A. N. Walker responds to Steve Knight:
In article <2400047@otter.hpl.hp.com> sfk@otter.hpl.hp.com (Steve Knight)
writes:
[deleted]
The procedure that is being delivered is "(REAL a) REAL: x + a",
in which "x" is a real variable declared somewhere else. In a scoped
language, how can this procedure even be contemplated except while "x"
is still in scope? The pseudo-instruction "throw away x, it's now gone
out of scope" is incompatible with a later pseudo-instruction "grab the
value stored in x and add it to a". Thus, the scope of the procedure is
*inevitably* tied up with that of "x". If you want your procedure to
work, you mustn't tell the computer to throw away "x" first! But this
seems to be what Steve wants. Or have I misunderstood something?
This is what Steve wants; he *hasn't* told the computer to throw anything away.
Just because x would go out of (lexical) scope need not mean that its store has
to be reclaimed.
You could always declare "HEAP REAL x" to give "x" global scope,
and then your procedure would work anywhere, even in parts of the program
that couldn't refer directly to "x".
I had this vague recollection that this still wouldn't work in Algol68; you can
give x global scope, but theres some intrinsic local required to refer to it,
and the defining document doesn't let you export *that* out of x's scope. But I
can't give details.
This is, of course, the *default*
situation in languages that do not have scoped variables, but that is a
different argument.
Which languages were you thinking of that ``do not have scoped variables''?
Perhaps (from the context of the discussion) you were intending to denote Lisp,
ML, or Scheme (or even Pop11!), but they all have what *I'* call scoped
variables. [In, for contrast, Pascal or C, the question hardly arises; either
there are no nested procedures, or the restrictions on their export are
draconian.]
This "restriction" is not, as Steve initially suggested, something
unorthogonal and peculiar to procedures; it applies equally to, for
example, pointers, and any other objects that might want to use "x".
That's true (but it's still a restriction, not a "restriction").
I still suspect
that Steve is *really* thinking of something different, namely the effect
of procedure *parameters*, which make functional composition less useful
in Algol than one might hope; I won't bore readers further with either
the problem or its proposed solutions, which have been well rehearsed in
this newsgroup in the past.
Isn't the latter (weakness of A68 functional composition) just a consequence of
the former (can't export a procedure outside the scope of one of its free
variables)?
--
Regards, Kers. | "You're better off not dreaming of the things to come;
Caravan: | Dreams are always ending far too soon."
Technical Details
Message-ID:
<KERS.91May13165106@cdollin.hpl.hp.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!hplabs!otter.hpl.hp.com!hpltoad!cdollin!kersReferences:
<1991Mar28.011025.16337@ico.isc.com> <2400047@otter.hpl.hp.com> <1991May10.162820.2662@maths.nott.ac.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!hplabs!otter.hpl.hp.com!hpltoad!cdollin!kers From: kers@hplb.hpl.hp.com (Chris Dollin) Newsgroups: comp.lang.misc Subject: Re: Re: Algol68 (and standards diatribe) Message-ID: <KERS.91May13165106@cdollin.hpl.hp.com> Date: 13 May 91 15:51:06 GMT References: <1991Mar28.011025.16337@ico.isc.com> <2400047@otter.hpl.hp.com> <1991May10.162820.2662@maths.nott.ac.uk> Sender: news@hplb.hpl.hp.com (Usenet News Administrator) Organization: Hewlett-Packard Laboratories, Bristol, UK. Lines: 61 In-Reply-To: anw@maths.nott.ac.uk's message of 10 May 91 16:28:20 GMT Nntp-Posting-Host: cdollin.hpl.hp.com