From: Ben Giddings Date: 2003-08-07T14:05:03+09:00 Subject: Re: Why does Ruby have callcc? Hi Jim, Lots of good stuff in there. I found one of the most useful pages was: http://www.sidhe.org/~dan/blog/archives/000213.html Where he says: "Well, if you remember with CPS, when you call a function you pass in a continuation that represents the place you're going to return to when you're done. In the normal case, a continuation is taken immediately before the call (with a resume address for the code right after the call, otherwise you'd call over and over and over...) and passed into the function you're calling" Which is just what Ruby is doing... however most of the practical uses of continuations I've seen don't follow this rule well, they don't use "callcc" as a means of jumping out of the associated block, instead they store the continuation in another variable outside the block, leave the block, then use it somewhere else. It looks like what he's talking about is better implemented with throw/catch in Ruby. I'm not clear on how continuations help with tail recursions or tail calls, however. Maybe there's something subtle in there I'm missing. Thanks, Ben