From: "matz (Yukihiro Matsumoto)" Date: 2022-11-10T14:48:42+00:00 Subject: [ruby-core:110692] [Ruby master Feature#19118] Allow numbered arguments to be inherited by block Issue #19118 has been updated by matz (Yukihiro Matsumoto). Status changed from Open to Closed I am sorry, but I don't think it's possible. `fork` or `Thread.new` may pass some values to the block that should be referenced by its own numbered parameters. We have no way to distinguish whether it's possible to inherit outer ones or not. Matz. ---------------------------------------- Feature #19118: Allow numbered arguments to be inherited by block https://bugs.ruby-lang.org/issues/19118#change-100033 * Author: 0x1eef (0x 1eef) * Status: Closed * Priority: Normal ---------------------------------------- Each these examples does not work as I would have hoped - each of them evaluates to puts(nil). ```ruby 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! -- https://bugs.ruby-lang.org/ Unsubscribe: