{"action":"created","issue":{"url":"https://api.github.com/repos/jruby/jruby/issues/1559","labels_url":"https://api.github.com/repos/jruby/jruby/issues/1559/labels{/name}","comments_url":"https://api.github.com/repos/jruby/jruby/issues/1559/comments","events_url":"https://api.github.com/repos/jruby/jruby/issues/1559/events","html_url":"https://github.com/jruby/jruby/issues/1559","id":29347285,"number":1559,"title":"Bug when lambdas are converted to blocks","user":{"login":"alexrothenberg","id":12577,"avatar_url":"https://avatars.githubusercontent.com/u/12577?v=3","gravatar_id":"","url":"https://api.github.com/users/alexrothenberg","html_url":"https://github.com/alexrothenberg","followers_url":"https://api.github.com/users/alexrothenberg/followers","following_url":"https://api.github.com/users/alexrothenberg/following{/other_user}","gists_url":"https://api.github.com/users/alexrothenberg/gists{/gist_id}","starred_url":"https://api.github.com/users/alexrothenberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexrothenberg/subscriptions","organizations_url":"https://api.github.com/users/alexrothenberg/orgs","repos_url":"https://api.github.com/users/alexrothenberg/repos","events_url":"https://api.github.com/users/alexrothenberg/events{/privacy}","received_events_url":"https://api.github.com/users/alexrothenberg/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2014-03-13T12:46:22Z","updated_at":"2015-08-10T20:14:58Z","closed_at":"2015-08-07T22:28:47Z","body":"While discussing a weird issue around treating lambdas as blocks in MRI (https://bugs.ruby-lang.org/issues/9605) @nobu found this odd behavior in jruby. \r\n\r\nIn jruby lambdas converted to blocks behave differently depending on whether they were created with the  ```lambda``` or ```->``` syntax.\r\n\r\n1. As expected lambdas enforce arity with both syntaxes when called.\r\n\r\n        $ jruby -v -e 'def test(l); l.call(1); end; test(lambda{p :ng})'\r\n        jruby 1.7.10 (1.9.3p392) 2014-01-09 c4ecd6b on Java HotSpot(TM) 64-Bit Server VM 1.7.051-b13 [darwin-x8664]\r\n        ArgumentError: wrong number of arguments (1 for 0)\r\n        call at org/jruby/RubyProc.java:267\r\n        test at -e:1\r\n        (root) at -e:1\r\n\r\n        $ jruby -v -e 'def test(l); l.call(1); end; test(->(){p :ng})' \r\n        jruby 1.7.10 (1.9.3p392) 2014-01-09 c4ecd6b on Java HotSpot(TM) 64-Bit Server VM 1.7.051-b13 [darwin-x8664]\r\n        ArgumentError: wrong number of arguments (1 for 0)\r\n        call at org/jruby/RubyProc.java:267\r\n        test at -e:1\r\n        (root) at -e:1\r\n\r\n2. Surprisingly, when converted to a block lambdas behave differently depending on which syntax they were created with. The arity check is gone from those created with ```lambda```\r\n\r\n        $ jruby -v -e 'def test; yield 1; end; test(&->(){p :ng})' \r\n        jruby 1.7.10 (1.9.3p392) 2014-01-09 c4ecd6b on Java HotSpot(TM) 64-Bit Server VM 1.7.051-b13 [darwin-x8664]\r\n        ArgumentError: wrong number of arguments (1 for 0)\r\n        test at -e:1\r\n        (root) at -e:1\r\n\r\n        $ jruby -v -e 'def test; yield 1; end; test(&lambda{p :ng})' \r\n        jruby 1.7.10 (1.9.3p392) 2014-01-09 c4ecd6b on Java HotSpot(TM) 64-Bit Server VM 1.7.051-b13 [darwin-x8664]\r\n        :ng"},"comment":{"url":"https://api.github.com/repos/jruby/jruby/issues/comments/129592088","html_url":"https://github.com/jruby/jruby/issues/1559#issuecomment-129592088","issue_url":"https://api.github.com/repos/jruby/jruby/issues/1559","id":129592088,"user":{"login":"alexrothenberg","id":12577,"avatar_url":"https://avatars.githubusercontent.com/u/12577?v=3","gravatar_id":"","url":"https://api.github.com/users/alexrothenberg","html_url":"https://github.com/alexrothenberg","followers_url":"https://api.github.com/users/alexrothenberg/followers","following_url":"https://api.github.com/users/alexrothenberg/following{/other_user}","gists_url":"https://api.github.com/users/alexrothenberg/gists{/gist_id}","starred_url":"https://api.github.com/users/alexrothenberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexrothenberg/subscriptions","organizations_url":"https://api.github.com/users/alexrothenberg/orgs","repos_url":"https://api.github.com/users/alexrothenberg/repos","events_url":"https://api.github.com/users/alexrothenberg/events{/privacy}","received_events_url":"https://api.github.com/users/alexrothenberg/received_events","type":"User","site_admin":false},"created_at":"2015-08-10T20:14:58Z","updated_at":"2015-08-10T20:14:58Z","body":"awesome thank you team for fixing this!"}}