Project

General

Profile

Actions

Bug #16406

closed

`(lambda_proc << normal_proc).lambda?` should return false

Added by alanwu (Alan Wu) almost 5 years ago. Updated about 4 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
[ruby-core:96139]
Tags:

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.

Actions #1

Updated by alanwu (Alan Wu) almost 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) almost 5 years ago

It was discussed and Matz approved to fix it after Ruby 2.7 release.

Actions #3

Updated by nobu (Nobuyoshi Nakada) almost 5 years ago

  • Target version set to 36
Actions #4

Updated by nobu (Nobuyoshi Nakada) almost 5 years ago

  • Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN to 2.5: DONTNEED, 2.6: REQUIRED, 2.7: REQUIRED
Actions #5

Updated by alanwu (Alan Wu) almost 5 years ago

  • Description updated (diff)

Updated by nobu (Nobuyoshi Nakada) almost 5 years ago

  • Status changed from Open to Assigned
  • Assignee set to alanwu (Alan Wu)
Actions #8

Updated by alanwu (Alan Wu) almost 5 years ago

  • Status changed from Assigned to Closed

Applied in changeset git|3264a00958f56e1ba75a95c93e59fc9cccf323e8.


Fix Proc#<< spec

[Bug #16406]

Updated by naruse (Yui NARUSE) over 4 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].

Actions #10

Updated by hsbt (Hiroshi SHIBATA) about 4 years ago

  • Target version changed from 36 to 3.0
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0