Project

General

Profile

Actions

Bug #15672

closed

Lambda implicit arguments, differences between lambda {} and -> {} specifications

Bug #15672: Lambda implicit arguments, differences between lambda {} and -> {} specifications

Added by takeshinoda (Takeshi Shinoda) over 6 years ago. Updated over 6 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.7.0dev (2019-03-18 trunk 67291) [x86_64-darwin18]
[ruby-core:91859]

Description

Hi

Are the following differences intentional?

$ ruby -v ruby 2.7.0dev (2019-03-18 trunk 67291) [x86_64-darwin18] 
$ cat ptn1.rb a = -> { p @1 } a.call(1) $ ruby ptn1.rb Traceback (most recent call last): 1: from ptn1.rb:2:in `<main>' ptn1.rb:1:in `block in <main>': wrong number of arguments (given 1, expected 0) (ArgumentError) 
$ cat ptn2.rb a = lambda { p @1 } a.call(1) $ ruby ptn2.rb 1 

thanks

Actions

Also available in: PDF Atom