🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #4049

Re: Re: Mea culpa (was: Re: Re: Algol68 (and standards diatribe))

#4049
From: Chris Dollin
Date: Thu, 23 May 1991 07:47
138 lines
7181 bytes
Dr A. N. Walker continues the debate:

[Quoting O'Keefe]

   In article <5809@goanna.cs.rmit.oz.au> ok@goanna.cs.rmit.oz.au
   (Richard A. O'Keefe) writes:

   >(1) BEGIN REAL x; ... END
   >    opens a new environment extending its lexically enclosing environment
   >    allocates some space 
   >    adds a binding (x->the new space) to the new environment
   >    ...
   >    closes the environment
   >(2) Space is reclaimed when the last reference to it goes away.

	   Well, I've just checked several of my old texts on Algol 60, and
   I haven't found anything that even remotely resembles that.  ("Binding"?
   "Environment"?  "Reference"?)  I haven't found a text that distinguishes
   in any way, let alone adequately, between variables, the storage that
   they occupy, and the identifiers that identify them.  

Yes, that's likely; since Algol 60 didn't have any reference-type objects
(certainly no programmer-allocated ones) that could be passed around, it was
easy to confuse (lexical) scope with (dynamic) extent [lifetime - see below].

   I checked my books
   on Pascal and C (and others) with similar lack of success.  Plenty of
   stuff about how "x" can only be used between the "BEGIN ... END", about
   name hiding, sometimes about stacks.  Even some of the books on Algol 68
   are distinctly hazy about all this.  [I'm pleased to say that Lindsey &
   van der Meulen and Brailsford & Walker both have explanations that still
   make sense to me, though I wouldn't have written either of them that way.]

Pascal and C are similar to Algol 60 in this regard, except for ``new''
(Pascal) and ``malloc'' (C), where the allocated objects are not
scope-controlled at all.

	   Using a modern perspective in an attempt to describe what 20-30
   year-old languages were thinking about is at best anachronistic, and
   almost certainly misleading.

If it clarifies the issue, it's ok. (Hmm ... is that a pun?) It would indeed be
a mistake to attribute the modern perspective to the designers of the languages
of the time.

   >However, "since time immemorial", the lambda calculus has permitted the
   >capture of outer variables in results:
   >	(\x. \y. + y x)(3)
   >returns a function equivalent to \y. + y 3.

	   Irrelevant to the semantics of Algol-like languages.  Maths has
   always been cavalier about scope and range of notation.

Isn't the lambda-calculus precisely the part of mathematics that *did* have
precise ideas about (lexical) scope?

[some stuff omitted]

   In a related posting, <KERS.91May17090215@cdollin.hpl.hp.com>,
   kers@hplb.hpl.hp.com (Chris Dollin) writes:

   >				       *I'd* say that the (equivalent of) the
   >above code means ``once you hit END, I no longer wish to be able to use the
   >name "x" to refer to ... er ... whatever it did refer to (ie, the variable,
   >or the location, or the value, etc)''.

	   Yes, I might say that too, but when [historically, this is not an
   attempt to discover your age!] would you *first* have said that?  Before
   Algol 68, there was little distinction made between "x" the identifier
   and "x" the variable inside the computer [at least in the books I read].

You didn't read any books about compilers then? :-)

I'll have to pass on this, because I'm not too sure of this historical detail.
[Since you didn't ask, I'm 37. Crumbs, that means this year's my 20th
Programming Anniversary!]

	   Again judging from books on my shelves, few other authors of books
   on C, Pascal or other languages are as concise or as accurate as Dennis
   Ritchie.  My conclusion is that the vast majority of authors, and hence
   of lecturers and students, and hence of practitioners, espouse a very
   simplistic view of scopes, lifetimes, extents, ranges, call them what
   you will.  Contributors to c.l.m are self-selected to be (relatively)
   knowledgeable about such things.

That's true, and regrettable, otherwise we might not need to have discussions
like this (which I'm enjoying, and finding interesting, and I hope others are
finding it educational; but I'd rather we didn't need to have it!).

   >Yes, it occured to me that there was a terminological problem, and that Algol68
   >(for some arcane reason) used ``scope'' to mean what was usually called
   >``extent'' if it was called anything, and then had to introduce a new word to
   >mean what ``scope'' meant.

   I asked a few friends in the local CS Dept;  none of them had any
   idea what I might mean by "extent". 

Mea culpa - I should have said ``lifetime'' (``extent'' was the Oxford word at
the time I was their, but ``lifetime'' was the informal word.)

   Their definitions of "scope" were as
   garbled as you might expect from the above.  They fared better when I asked
   about "lexical/dynamical scope".  

Like all surveys, it depends how you ask the question :-) - without some sort
of context (eg ``variables in programming languages'') it wouldn't be clear
what (kind of) scope; I think we've established that context here.

   Having been bitten once or twice in the
   early 70's, I have since tried [not always successfully] to use "scope",
   "range", "reach", "environ" and other technical words in the Algol sense,
   to explain [eg "range" == "lexical scope"] the notation when first used,
   and to be prepared to interpret other usages.  That the notation is not
   more widely understood seems to me to be just another example of an Algol
   feature that was ahead of its time.

I agree that it's right to have a variety of technical terms to cover the
concepts, and that the Algol68 ones are fine - *except* that they didn't come
into widespread use, and I believe, in the context, that ``scope'' will
nowadays be taken to mean ``lexical scope'', unless (again given the context)
it were taken to mean ``dynamic scope''.

But then, I live a specialised life.

   >							 But I think the other
   >contributors mean ``lexical scope'', aka ``range'', by scope. Certainly that's
   >what Steve means [...]

	   That's what I assumed Steve meant first time, and what he denied.

Then I fear one of you must have misunderstood the other (the other possibility
is too horrible to be contemplated).

--

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.91May23084737@cdollin.hpl.hp.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!sdd.hp.com!hplabs!otter.hpl.hp.com!hpltoad!cdollin!kers
References: <5809@goanna.cs.rmit.oz.au> <KERS.91May17090215@cdollin.hpl.hp.com> <1991May22.142316.11622@maths.nott.ac.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!sdd.hp.com!hplabs!otter.hpl.hp.com!hpltoad!cdollin!kers
From: kers@hplb.hpl.hp.com (Chris Dollin)
Newsgroups: comp.lang.misc
Subject: Re: Re: Mea culpa (was: Re: Re: Algol68 (and standards diatribe))
Message-ID: <KERS.91May23084737@cdollin.hpl.hp.com>
Date: 23 May 91 07:47:37 GMT
References: <5809@goanna.cs.rmit.oz.au> <KERS.91May17090215@cdollin.hpl.hp.com> <1991May22.142316.11622@maths.nott.ac.uk>
Sender: news@hplb.hpl.hp.com (Usenet News Administrator)
Organization: Hewlett-Packard Laboratories, Bristol, UK.
Lines: 138
In-Reply-To: anw@maths.nott.ac.uk's message of 22 May 91 14:23:16 GMT
Nntp-Posting-Host: cdollin.hpl.hp.com