On Thu August 7 2003 10:31 pm, Dan Doel wrote:
> This works, but only because you're implementing both with callcc.

Well... considering that at the moment there isn't any other way to create a 
continuation, I didn't have all that much choice.  ;)
 
> cc = Continuation.new
> ...
> cc.call(a, b, c)
> 
> would have no way of getting a, b, and c back to where Continuation.new 
> was called (because it doesn't make sense for Continuation.new to return 
> anything but a Continuation object).

Righto.  Hence my idea there should be a Continuation.run (though I'm still 
not sure I like that name)

> I guess the bottom line is, you still need callcc (or something like 
> it), even if you have Continuation.new.  You can write Continuation.new 
> using callcc, but you can't write callcc using Continuation.new (without 
> having some magic stuff happen).  callcc is more general.

Yeah, my only complaint with callcc is that the syntax you use if you want to 
use it like my concept of Continuation.new (i.e. in a setjmp/longjmp way) is 
really ugly.  You have a block that doesn't get used in a very block-like 
manner, a variable being assigned a value in a way that seems like a 
side-effect, etc.

I can now see that for certain uses of continuations, you need to be able to 
assign a return location somewhere ahead of where you are now, which is why a 
block is useful.  But I think there are other cases where the block just 
makes things confusing.
 
> However, you can, of course, write a little extention that adds the 
> Continuation.new and Continuation.run methods for your own use, if you 
> find those more clear than callcc, which is a nice feature of Ruby.

Yup.  If anybody else likes my extentions to the Continuation class, let me 
know and I'll wrap them up in an RAA project.  If I'm the only one who 
objects to the aesthetics of callcc, then I'll just keep it for myself.  But 
before I do create an RAA project, I want to make sure that I didn't miss a 
subtlety and that my Continuation.new and Continuation.run will do everything 
that you can currently do with callcc.

Thanks,

Ben