Hi, David Flanagan wrote: > f.transfer(100) Fiber::Core and Fiber::Core#transfer is black magic. So I'm planning to rename this class and method to Fiber::DangerousCore::__unsafe_transfer__I_cant_promise_your_program_run_correctly__! > You can also use the higher-level Fiber (instead of Fiber::Core) API, > but I don't understand it as well: > > g = Fiber.new { |x| > puts "G1: #{x}" > x = Fiber.yield(x+1) # Can't use resume here: double resume error > puts "G2: #{x}" > x = Fiber.yield(x+1) > } > > f = Fiber.new { |x| > puts "F1: #{x}" > x = g.resume(x+1) > puts "F2: #{x}" > x = g.resume(x+1) > puts "F3: #{x}" > } > > f.resume(100) > > These seem more interesting that continuations, so I understand why Matz > would say that Fibers are more likely to stay in 1.9 than continuations > are. These method names (resume/yield) are from Lua. "transfer" is from Modula-2. "double resume error" is from Python's generator. ---- BTW, I'm thinking about name "Fiber". Current Fiber means Semi-Coroutine. Fiber::Core is Coroutine. Yes, name of Fiber is from Microsoft, but it's means Semi-Coroutine such as Lua's coroutine and Python's generator. -- // SASADA Koichi at atdot dot net