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

Re: Demystifying Continuations



On Thu, 21 Mar 2002, David Simmons wrote:

> Simply put, from all I've read and all I can tell they are:
>
> A cloneable reified objectification of a stack (call-chain w/closures).

<snip>

> Since (in a Smalltalk implementation) these things are all objects, we
> can copy them (cloneable). And, in Smalltalk, a <Context> is executable
> and otherwise manipulatable through a wide range of MOP facilities.

Yup.  In fact, I make very heavy use of this approach in my Squeak web
framework (http://beta4.com/seaside).  The implementation of
continuations and call/cc that I use is around 8 or 9 lines of code.

However, your point about native threads is quite apt - simply copying the
context objects to get continuations only works in fairly straightforward
VMs like Squeak's.  I've been unable to get continuations working in
smalltalks like Smalltalk/X or Smalltalk MT that have a closer
relationship to the C stack (to Cincom's credit, the VW JIT handles them
just fine - but then VW doesn't have native threading).

Have you tried implementing call/cc in SmallScript?  Will you?  Among
other things, it would be nice to have another target to port my framework
to...

Cheers,
Avi