[ruby-core:93783] [Ruby master Bug#16004] Kernel#lambda captured with Kernel#method doesn't create lambdas
From:
eregontp@...
Date:
2019-07-15 09:22:04 UTC
List:
ruby-core #93783
Issue #16004 has been updated by Eregon (Benoit Daloze).
I would guess this is because Method#call introduces an extra frame:
```
$ ruby -e 'def foo; yield; end; method(:foo).call { raise "bar" }'
Traceback (most recent call last):
3: from -e:1:in `<main>'
2: from -e:1:in `call'
1: from -e:1:in `foo'
```
Basically, `lambda` only works as a literal `lambda { ... }`, similarly to `-> { ... }` which clearly can only be used with a literal block.
Like in #15973, I think this is just an incorrect usage of `#lambda`.
What's the use case for this?
----------------------------------------
Bug #16004: Kernel#lambda captured with Kernel#method doesn't create lambdas
https://bugs.ruby-lang.org/issues/16004#change-79438
* Author: alanwu (Alan Wu)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.7.0dev (2019-07-15T00:58:26Z master 223854ebe8) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
`ruby -e 'p method(:lambda).call{}.lambda?'` prints false on 2.3.x-master(223854ebe8).
I think it should create lambdas.
--
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>