On Wednesday, August 6, 2003, at 07:42  PM, Eric Hodel wrote:
> class Continuation
>   def self.new
>     if block_given? then
>       callcc { |c| yield(c) }
>     else
>       callcc { |c| return c }
>     end
>   end
> end

Interesting... now I'm trying to understand what happens here when you 
call Continuation.new.  If I understand things correctly, with the 
no-block version, new returns at the "return c" statement, then when 
the continuation is called, it goes back to the end of that block, and 
self.new returns... since that method overall has no return value, it 
is nil, and so nothing is assigned.  This one seems to work:

class Continuation
   def self.new
     retval = nil
     if block_given?
       callcc {|retval| return retval}
       yield(retval)
     else
       callcc {|retval| return retval}
     end
     retval
   end
end

This version does, however, redefine how the associated block is used 
with callcc.  With callcc, when you call the resulting continuation 
object, you continue from the end of the block.  With this version you 
yield to the block.

Now I'm going to go try to understand the rest of the code you sent me. 
  :)

Ben