< :前の番号
^ :番号順リスト
> :次の番号
P :前の記事(スレッド移動)
N :次の記事(スレッド移動)
|<:前のスレッド
>|:次のスレッド
^ :返事先
_:自分への返事
>:同じ返事先を持つ記事(前)
<:同じ返事先を持つ記事(後)
---:分割してスレッド表示、再表示
| :分割して(縦)スレッド表示、再表示
~ :スレッドのフレーム消去
.:インデックス
..:インデックスのインデックス
Issue #7314 has been reported by schneems (Richard Schneeman).
----------------------------------------
Bug #7314: Convert Proc to Lambda doesn't work in MRI
https://bugs.ruby-lang.org/issues/7314
Author: schneems (Richard Schneeman)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: 1.9.3
=begin
I have code where I need to convert a proc to a lambda (i need to be able to return out of the block). I would expect that passing a proc into a lambda to return a lambda. When I run this code on MRI i do not get the result I would expect
my_proc = proc { |x| x }
my_lambda = lambda &my_proc
my_lambda.lambda?
The result is (({false})) but I would expect it to be (({true}))
There is currently a way to turn a proc into a lambda in MRI like this:
def convert_to_lambda &block
obj = Object.new
obj.define_singleton_method(:_, &block)
return obj.method(:_).to_proc
end
But this feels like a hack, and is not supported across other implementations. I would expect that passing a proc into a lambda to return a lambda, I believe it is a bug.
=end
--
http://bugs.ruby-lang.org/