Re: [jruby-user] Range Oddity
Christian MICHON <[email protected]> Sun, 9 Nov 2014 09:16:16 +0100
| Newsgroups | gmane.comp.lang.jruby.user |
|---|---|
| Message-ID | <CACx2yF-5WJaS5653nrYhNB3XQ1__SoVj1Bj-h+eta3ECcMRayQ@mail.gmail.com> |
The 3rd snippet is the only valid style. Obviously a refactoring uncompleted or untested. On Nov 9, 2014 7:18 AM, "Keith Bennett" <[email protected]> wrote: > 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 > >