From: Richard A. O'Keefe
Subject: Re: Closures? Continuations??
Date: 
Message-ID: <4hlts4$gee@goanna.cs.rmit.EDU.AU>
······@netcom.com (Will Hartung) writes:
>I was hoping that someone could mail me or post some "laymen"
>definitions of:

>    o Closures

>    o Continuations

>    o Opaque Types

>The Lisp/Scheme community seems to have a different
>vocabulary than we ...ummm... "hacks" who aren't designing languages,
>rather just trying to apply them.

The use of the terms "closure" and "continuation" in the Lisp and
Scheme communities is absolutely standard.  It is identical to the
use of these terms in the wider functional programming community,
and indeed the mathematics-of-computing community in general.

A "closure" is a-particular-procedure-in-a-particular environment.
The obvious way to implement closures is as a pair of pointers,
a pointer to the executable code of the procedure, and
a pointer to the environment where it is defined.

When a Pascal program passes a procedure or function as an argument
to another procedure or function, it passes a closure.
When you pass a block in a message in a Smalltalk program, what
is received at the other end is a closure: the code of the block
plus an indication of where to find the non-local variables that
the block might use.

The only thing that is different about Lisp and Scheme is that they
let a closure outlive the block that created it, which typically means
that they use a rather smarter representation for closures, but a
closure in those languages can still be understood as a function
*in an environment*.

A continuation is just a function.  For an introduction to continuations,
see any book on formal definition of programming languages, such as
	The Denotational Description of Programming Languages
	Michael J. C. Gordon
	Springer, ISBN 0-387-90433-6

J.C.Reynolds had a wonderful history-of-programming languages paper about
the history of continuations.

An opaque type is just a type which is opaque.  Simple.

-- 
The election is over, and Australia lost; the idjits elected _politicians_!
Richard A. O'Keefe; http://www.cs.rmit.edu.au/~ok; RMIT Comp.Sci.