Hi,
I have tried jruby1.4, and something works in ruby1.8.7 doesn’t
works in
jruby1.4.
My code is like below.
array = [‘a’,‘b’,‘c’]
array.select.with_index{|x, i| i >= 1}
got C:/Program
Files/jruby-1.4.0/lib/ruby/site_ruby/shared/builtin/core_ext/symbol.rb:1:in
`select’: yield called out of block (LocalJumpError)
but this works well
array = [‘a’,‘b’,‘c’]
q = array.enum_for(:select).with_index{|x, i| i >= 1}
Is this a bug? and Should i file it in jira?
koji
On Nov 4, 2009, at 9:40 PM, koji Lin wrote:
(LocalJumpError)
but this works well
array = [‘a’,‘b’,‘c’]
q = array.enum_for(:select).with_index{|x, i| i >= 1}
Is this a bug? and Should i file it in jira?
koji
It looks like a bug to me, in the sense that JRuby’s behavior deviates
from MRI’s. The thing is, Enumerable#select without body doesn’t seem
to be documented (please educate me if I missed the documentation), so
in that sense, it is not. In fact, there are no spec on Array#select
that contains no blocks (yet).
Regardless, I think it is worth opening a JIRA ticket.
By the way, the code works with JRuby in 1.9 mode.
Hiro
In the last ruby build there were some backports that haven’t been
included
in jruby yet, perhaps that’s one of those. I’m filing a bug and sending
a
patch in a while.