Project

General

Profile

Actions

Bug #12705

closed

yielding args to a lambda uses block/proc rather than lambda/method semantics

Added by bughit (bug hit) over 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Target version:
[ruby-core:77065]

Description

def yield_test
  yield 1, 2
  yield [1, 2]
end

def foo(a, b)
  p a, b
end

method_lambda = method(:foo).to_proc
normal_lambda = ->a, b{p a, b}

yield_test(&normal_lambda)

yield_test(&method_lambda)

the yield of [1, 2] to the method_lambda produces an argument error as you would expect
but the same yield to the normal_lamda does not, the single array arg is slpatted per block/proc semantics


Related issues

Related to Ruby master - Bug #13391: wrong number of arguments error for Hash#map when lambda givenClosedko1 (Koichi Sasada)Actions
Actions

Also available in: Atom PDF