Project

General

Profile

Bug #16406

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

Added by alanwu (Alan Wu) about 2 months ago. Updated 29 days ago.

Status:
Closed
Priority:
Normal
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.

Associated revisions

Revision 3264a009
Added by alanwu (Alan Wu) 29 days ago

Fix Proc#<< spec

[Bug #16406]

History

#1

Updated by alanwu (Alan Wu) about 2 months 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 1 month ago

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

#3

Updated by nobu (Nobuyoshi Nakada) about 1 month ago

  • Target version set to 2.8
#4

Updated by nobu (Nobuyoshi Nakada) about 1 month ago

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

Updated by alanwu (Alan Wu) about 1 month ago

  • Description updated (diff)

Updated by nobu (Nobuyoshi Nakada) about 1 month ago

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

Updated by alanwu (Alan Wu) 29 days ago

  • Status changed from Assigned to Closed

Applied in changeset git|3264a00958f56e1ba75a95c93e59fc9cccf323e8.


Fix Proc#<< spec

[Bug #16406]

Also available in: Atom PDF