[jruby-user] Range Oddity

Keith Bennett <[email protected]> Sun, 9 Nov 2014 01:17:20 -0500
Newsgroups gmane.comp.lang.jruby.user
Message-ID <CAJR0di4ZbeK9jj_PNdsNbqUXt7SxKJLbBPBdcyCfNZN2fW3NpA@mail.gmail.com>
All -

I'm having a strange issue and am wondering if you might know anything
about it.

I'm troubleshooting a piece of code that has something like this in it:

0..16.times { ... }

I believe the 0.. is extraneous and the code should behave as:

0..(16.times { ... } )

And the return value of the expression is not used so I think it should be
equivalent to simply:

16.times { ... }

However, sometimes when this code is run the block appears to execute 0
times instead of 16.  This happens only when the code is run in JRuby
(jruby-1.7.16 and jruby-1.6.8 on both OS X and Linux); not on MRI Ruby
1.9.3 and 2.1.4.

Unfortunately I'm unable to provide a minimal test case.

Does this ring a bell for anyone?  Any clue as to what might be happening?

Thanks,
Keith