< :前の番号
^ :番号順リスト
> :次の番号
P :前の記事(スレッド移動)
N :次の記事(スレッド移動)
|<:前のスレッド
>|:次のスレッド
^ :返事先
_:自分への返事
>:同じ返事先を持つ記事(前)
<:同じ返事先を持つ記事(後)
---:分割してスレッド表示、再表示
| :分割して(縦)スレッド表示、再表示
~ :スレッドのフレーム消去
.:インデックス
..:インデックスのインデックス
Issue #10499 has been updated by dazuma (Daniel Azuma).
Note that the documentation still specifies the old behavior in 3.0.0.
> Creates a new Proc object, bound to the current context. ::new may be called without a block only within a method with an attached block, in which case that block is converted to the Proc object.
https://ruby-doc.org/core-3.0.0/Proc.html#method-c-new
https://github.com/ruby/ruby/blob/95aff214687a5e12c3eb57d056665741e734c188/proc.c#L800-L813
----------------------------------------
Feature #10499: Eliminate implicit magic in Proc.new and Kernel#proc
https://bugs.ruby-lang.org/issues/10499#change-89745
* Author: headius (Charles Nutter)
* Status: Open
* 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: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>