From: Robert Dober Date: 2007-06-06T17:31:17+09:00 Subject: Re: code problems On 6/6/07, Rick DeNatale wrote: > On 6/4/07, fREW wrote: > > Also, can someone explain the > > difference between closures and continuations? I thought they were > > the same thing. > > http://talklikeaduck.denhaven2.com/articles/2007/06/05/closing-in-on-closures-and-jumping-into-continuations > > -- > Rick DeNatale > > Hi Rick I am still struggeling with continuations :(, as a matter of fact I hoped that they would behave as described above, but they do not, it seems. When I execute the code from your blog def continuation i = 0 lola = nil callcc {|cc| puts "In callcc";lola = cc} puts "i is now #{i}" i += 1 lola end cont = continuation # point of looping cont.call http://rubyquiz.com/quiz70.html I just get an endless loop, do you have an explanation for it? I remember there was a Ruby Quiz http://rubyquiz.com/quiz70.html with an excellent solution of Jim Weirich. One day I thought I understood the mechanism and optimized one callcc away, boy I made a complete fool out of myself, you can find it on the archives, I am not going to give the link ;). Well, just confused... Cheers Robert -- You see things; and you say Why? But I dream things that never were; and I say Why not? -- George Bernard Shaw