Project

General

Profile

Actions

Bug #791

closed

Fiber using a Proc object with a parameter having default value doesn't work

Added by Skade (Florian Gilcher) over 13 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
Backport:
[ruby-core:20088]

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

Actions #1

Updated by ko1 (Koichi Sasada) over 13 years ago

  • Assignee set to ko1 (Koichi Sasada)

=begin

=end

Actions #2

Updated by nobu (Nobuyoshi Nakada) over 13 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r20432.
=end

Actions

Also available in: Atom PDF