logo       

Array.min using a block gives error - `min': yield called out of block (Loc: msg#00000

lang.jruby.user

Subject: Array.min using a block gives error - `min': yield called out of block (LocalJumpError)

Hi,

I am using JRuby 0.8.2 with code:

a=['abc','d']
puts a.min()
puts a.min { |a,b| a.length <=> b.length }

I expect to get:
abc
d

Using standard ruby, this works fine, but JRuby gives error:

test.rb:3:in `min': yield called out of block (LocalJumpError)
from test.rb:3:in `call'
from /home/enebo/release/jruby/src/builtin/Enumerable.rb:157:in
`min'
from test.rb:3:in `each'
from /home/enebo/release/jruby/src/builtin/Enumerable.rb:158:in
`min'
from test.rb:3

Has anyone else had a similar problem?

Should this work, or is this a bug in JRuby? I have seen bug 1048209
<http://sourceforge.net/tracker/?group_id=35413&atid=413912&func=detail&;
aid=1048209> that looks similar.

I can see the code in ThreadContext:208 that is throwing the exception,
and so I might look into what is causing the problem, but if this is not
meant to work, then I'm obviously wasting my time. I will add this to
the current bug list.

Joel Hockey
Solution Architect
Hewlett-Packard



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise