DISCLAIMER: It has been said that continuations can cause brain damage... I
am not liable for any such damage if you read further.

I was thinking about closures, continuations, etc., and I suddenly had this
thought that I might be able to "roll my own" continuations using closures.
It doesn't seem to work, though. Can anyone tell me why?

  def make_c
    yield(proc{|*r| return r})
  end

  puts(make_c do |c|
    puts "In continuation..."
    c.call("Done")
    puts "...oops"
  end)

  C:\ruby-projects>ruby t.rb
  In continuation...
  ...oops
  nil

It's obvious that calling return in a block doesn't do what I thought it
did... so what does it do?


Nathaniel

P.S. Yes, I know about callcc... I was just playing.

<:((><