Actions
Bug #16406
closed`(lambda_proc << normal_proc).lambda?` should return false
Description
Consider:
plus = proc { |a, b| a + b }
mult_two = ->(x) { x * 2 }
composed = mult_two << plus
p [composed. lambda?, composed.call([1, 2])]
I think this ought to print [false, 6]
instead of [true, 6]
, as the call composed.call([1, 2])
is clearly not using lambda semantics.
Since composed = f << g
calls g
first, I think it makes sense to report #lambda?
base on whether g
has lambda semantics.
I have a pull request at https://github.com/ruby/ruby/pull/2729 to make this change.
Updated by alanwu (Alan Wu) about 5 years ago
- Subject changed from `(lambda_proc << normal_proc).lambda?` returns true to `(lambda_proc << normal_proc).lambda?` should return false
Updated by ko1 (Koichi Sasada) about 5 years ago
It was discussed and Matz approved to fix it after Ruby 2.7 release.
Updated by nobu (Nobuyoshi Nakada) about 5 years ago
- Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN to 2.5: DONTNEED, 2.6: REQUIRED, 2.7: REQUIRED
Updated by nobu (Nobuyoshi Nakada) almost 5 years ago
- Status changed from Open to Assigned
- Assignee set to alanwu (Alan Wu)
Updated by alanwu (Alan Wu) almost 5 years ago
Should be addressed by https://git.ruby-lang.org/ruby.git/commit/?id=99c7b0b7ea789643bef60085ab59e4b62011ef8b
Updated by alanwu (Alan Wu) almost 5 years ago
- Status changed from Assigned to Closed
Updated by naruse (Yui NARUSE) almost 5 years ago
- Backport changed from 2.5: DONTNEED, 2.6: REQUIRED, 2.7: REQUIRED to 2.5: DONTNEED, 2.6: REQUIRED, 2.7: DONE
ruby_2_7 52bb32d6b71365cb24273de3eed5a712206815f3 [Backport #16406].
Updated by hsbt (Hiroshi SHIBATA) about 4 years ago
- Target version changed from 36 to 3.0
Actions
Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0