General

Profile

alexrothenberg (Alex Rothenberg)

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 0 1 1

Activity

03/18/2014

08:22 PM Ruby Bug #9605: Chaining "each_with_index.detect &lambda" raises ArgumentError
@nobu I meant to tell you how honored I am that you and matz are taking so much time talking about this issue and even considering changing this small corner of ruby itself. The idea of changing the language because of something I notice... alexrothenberg (Alex Rothenberg)

03/13/2014

02:53 PM Ruby Bug #9605: Chaining "each_with_index.detect &lambda" raises ArgumentError
If I understand correctly what you're saying is that it would behave as below.
~~~ruby
plus = ->(x,y) {puts x+y}
~~~
1. This would continue to work as it does today
~~~ruby
def test
yield 1,2
end
test...
alexrothenberg (Alex Rothenberg)
12:46 PM Ruby Bug #9605: Chaining "each_with_index.detect &lambda" raises ArgumentError
I created a jruby issue https://github.com/jruby/jruby/issues/1559 to track the odd "lambda" vs "->" difference. alexrothenberg (Alex Rothenberg)
12:34 PM Ruby Bug #9605: Chaining "each_with_index.detect &lambda" raises ArgumentError
Finally found another implementation that behaves identically to MRI. RubyMotion acts the same with "each_with_index.map" accepting 2 args while "each_with_index.detect" raises an ArgumentError.
~~~
$ rake
Build ./build/iPhoneS...
alexrothenberg (Alex Rothenberg)
12:24 PM Ruby Bug #9605: Chaining "each_with_index.detect &lambda" raises ArgumentError
A little more digging and I found Rubinius is consistent with the lambda and -> syntax but neither raises the ArgumentError. It seems like they remove the arity check when the lambda is converted to a block
~~~
$ ruby -v -e '[1].each...
alexrothenberg (Alex Rothenberg)
12:20 PM Ruby Bug #9605: Chaining "each_with_index.detect &lambda" raises ArgumentError
Wow this gets weirder and weirder. It seems to be happening when jruby turns a lambda created with "->" syntax into a block. MRI does consistently raise ArgumentError in all 4 cases.
$ jruby -v -e 'def test(l); l.call(1); end; test(l...
alexrothenberg (Alex Rothenberg)

03/12/2014

12:58 PM Ruby Bug #9605: Chaining "each_with_index.detect &lambda" raises ArgumentError
Nobuyoshi Nakada wrote:
> It conflicts with existing behaviors too much.
I'm not surprised this caused other problems but I was hoping it wouldn't.
Is the current behavior now the expected behavior of Ruby and should I let other i...
alexrothenberg (Alex Rothenberg)

03/07/2014

08:14 PM Ruby Bug #9605: Chaining "each_with_index.detect &lambda" raises ArgumentError
@nobu Wow, you fixed this issue so quickly. I wrote a few additional test cases that fail on trunk but pass on your branch in case you want to merge them in https://github.com/nobu/ruby/pull/1
Thank you!
alexrothenberg (Alex Rothenberg)

03/06/2014

09:11 PM Ruby Bug #9605 (Closed): Chaining "each_with_index.detect &lambda" raises ArgumentError
I found an odd edge case where "detect" and "select" behave differently from other methods of Enumerable.
Normally these methods yield a single argument to a block but when you chain them after "each_with_index" they yield two argumen...
alexrothenberg (Alex Rothenberg)

Also available in: Atom