From: nobu@... Date: 2021-01-04T06:55:36+00:00 Subject: [ruby-core:101905] [Ruby master Feature#10499] Eliminate implicit magic in Proc.new and Kernel#proc Issue #10499 has been updated by nobu (Nobuyoshi Nakada). Thank you, updated. ---------------------------------------- Feature #10499: Eliminate implicit magic in Proc.new and Kernel#proc https://bugs.ruby-lang.org/issues/10499#change-89749 * Author: headius (Charles Nutter) * Status: Closed * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) ---------------------------------------- Proc.new and Kernel#proc have a little known feature: if called without a block, they capture whatever block was passed to the current method. I propose that this feature should be removed, finally, since it: * Doesn't enhance readability (where is this block coming from?) * Doesn't reflect any other behavior in Ruby * Can lead to bugs (call either without a block accidentally and you aren't sure what you'll get) I believe this was an implementation artifact in MRI, since the most recently-pushed block would still be on global stacks, which is where the logic for proc and Proc.new looked for it. All argument syntaxes now support &block, which I believe is the correct way to clearly, explicitly capture the incoming block into an object. Thoughts? -- https://bugs.ruby-lang.org/ Unsubscribe: