>>>>> "d" == daz <dooby / d10.karoo.co.uk> writes: d> There's a clumsy way of doing it, too. d> def tt d> ret = nil # until the new block var rules arrive. d> callcc {|cc| ret = cc} d> # etc d> ret d> end Well not really, here a stupid example svg% cat b.rb #!/usr/bin/ruby def tt p "enter in tt" callcc{|cc| return cc} p "call with current continuation" end cc = tt p "after tt #{cc.inspect}" cc.call unless cc.nil? svg% svg% b.rb "enter in tt" "after tt #<Continuation:0x40099f84>" "call with current continuation" "after tt nil" svg% ruby has "captured" the continuation just after the block, this is why it's important to return it inside the block. When you call cc.call the control is transferred at the line p "call with current continuation" Guy Decoux