[squeak-dev] Direct implementation of shift/reset in Smalltalk

Matthew Fulmer tapplek at gmail.com
Thu Apr 21 16:01:17 UTC 2011


On Thu, Apr 21, 2011 at 12:50:50PM +0100, Frank Shearar wrote:
> I finished a preliminary version of the shift/reset control operator for 
> creating and using partial continuations:
> 
> http://www.squeaksource.com/Control.html
> 
> It's pretty easy to use:
> 
> [ 1 + 2 ] reset => 3
> [ 1 + [:k | 2 ] shift ] reset => 2 (because k's not used, that part of 
> the stack's discarded)
> [ 1 + [:k | k value: 2 ] shift ] reset => 3
> [ 1 + [:k | k value: (k value: 2) ] shift ] reset => 4
> [ 1 + [:k | cont := k. k value: 0 ] shift ] reset => 1, and cont now 
> holds the continuation, for later (re-)use.
> 
> It probably has horrific bugs and will eat your machine. It does, 
> however, have as full a test suite as I can imagine, the execution of 
> which, at least, does not eat your machine!
> 
> I wrote a reasonable walk-through of the library [1] that also mentions 
> good starting points in the literature on the subject of 
> partial/delimited/composable continuations.
> 
> I wrote the library with two intentions - firstly, that I could 
> understand partial continuations and, secondly, to try provide a common 
> vocabulary for working with partial continuations.
> 
> Comments welcome!
> 
> frank
> 
> [1] 
> http://www.lshift.net/blog/2011/04/20/direct-implementation-of-shiftreset-in-smalltalk
> 

I never did understand the functional difference between
continuations and suspended processes. Do you have any links to
how partial continuations are useful?

-- 
Matthew Fulmer (a.k.a. Tapple)



More information about the Squeak-dev mailing list