Project

General

Profile

Actions

Feature #19118

closed

Allow numbered arguments to be inherited by block

Added by 0x1eef (0x 1eef) about 2 years ago. Updated about 2 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:110684]

Description

Each these examples does not work as I would have hoped - each of them evaluates to puts(nil).

def foo
  yield
end
[1,2,3].each do
  Process.wait fork { puts(_1) }
end
[1,2,3].each do
  Thread.new { puts(_1) }.join
end
[1,2,3].each do
  foo { puts(_1) }
end

Is it possible for numbered parameters to be inherited if the inner block is yielded with no arguments ?

Thanks!

Actions

Also available in: Atom PDF

Like0
Like0Like0Like1