Bug #791
closedFiber using a Proc object with a parameter having default value doesn't work
Description
=begin
If you pass a Proc with a default value on a parameter into a Fiber, the default value is ignored.
Example by Wolfgang NĂ¡dasi-Donner:
irb(main):001:0> p = ->(i=4){i+5}
=> #<Proc:0xe8a370@(irb):1 (lambda)>
irb(main):002:0> p[]
=> 9
irb(main):003:0> Fiber.new(&p).resume
NoMethodError: undefined method +' for nil:NilClass from (irb):1:in
block (3 levels) in irb_binding'
A more useful example is...
irb(main):001:0> f = Fiber.new(&(->(i=5){loop{Fiber.yield i+=1}}))
=> #Fiber:0xe860f8
irb(main):002:0> f.resume
NoMethodError: undefined method +' for nil:NilClass from (irb):1:in
block (4 levels) in irb_binding'
from (irb):1:in loop' from (irb):1:in
block (3 levels) in irb_binding'
Regards,
Florian Gilcher
=end
Updated by nobu (Nobuyoshi Nakada) almost 16 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
Applied in changeset r20432.
=end