[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

continuations and linear types




i'm very excited about the possibilities goo presents; it's almost
everything i've wanted from a language.

my primary interest is in distributed and concurrent apps; hence, i've
been quite interested in the disucssions of continuations and threads so
far. I propose adding linear types to goo; that is, adding a kind of
object whose reference count can never exceed 1. Henry Baker describes
the advantages and ramifications of such objects in his paper
"'Use-Once' Variables and Linear Objects":
http://www.pipeline.com/~hbaker1/Use1Var.html

Linear objects have two major advantages: because a linear object can
only have one "owner" at a time, it never needs synchronisation; by the
same token, its lifetime can be statically determined and thus it avoids
garbage collection. Since goo has already adopted type annotation of
functions, and because of its commitment to efficiency and static
analysis, I believe they would be a sensible addition.


Additionally, linear continuations have unique advantages; they allow
continuations to be stack allocated (since they cannot be captured), and
avoid the bad interactions shareable continuations have with
unwind-protect and tail recursion (for a detailed discussion of this
issue, see http://lists.tunes.org/archives/tunes/1999-August/002235.html
) while providing most of the control advantages of shareable
continuations such as coroutines and microthreading.

Of course, some applications require non-linear continuations;
Queinnec-style use of continuations for web apps most notably, as well
as prolog-style backtracking. My own feelings are that only allowing
linear continuations is a sufficient tradeoff between expressitivity and
clean semantics/efficient implementation.

Other related links:
http://www.pipeline.com/~hbaker1/LinearLisp.html
http://www.pipeline.com/~hbaker1/ObjectIdentity.html

-- 
Allen Short        Programmer-Archaeologist       
washort@twistedmatrix.com
One of the most overlooked advantages to computers is...  If they do
foul up, there's no law against whacking them around a little.  -- Joe
Martin