New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chunk_while not returning results equivalent to MRI ruby 2.3+ (jruby 9.1.6.0) #4410

Closed
olbrich opened this Issue Dec 25, 2016 · 8 comments

Comments

Projects
None yet
4 participants
@olbrich

olbrich commented Dec 25, 2016

Environment

$ ruby -v
jruby 9.1.6.0 (2.3.1) 2016-11-09 0150a76 Java HotSpot(TM) 64-Bit Server VM 25.0-b70 on 1.8.0-b132 +jit [darwin-x86_64]
$ uname -a
Darwin Kevins-MacBook-Pro.local 16.3.0 Darwin Kernel Version 16.3.0: Thu Nov 17 20:23:58 PST 2016; root:xnu-3789.31.2~1/RELEASE_X86_64 x86_64

Expected Behavior

$  rvm use ruby-2.4.0
Using ruby-2.4.0
$ irb
2.4.0 :001 > [1].chunk_while { |x| x.even? }.to_a
 => [[1]]

Actual Behavior

$  rvm use jruby-9.1.6.0
Using jruby-9.1.6.0
$ irb
jruby-9.1.6.0 :001 > [1].chunk_while { |x| x.even? }.to_a
 => []

@enebo enebo added the core label Dec 27, 2016

@enebo

This comment has been minimized.

Show comment
Hide comment
@enebo

enebo Dec 27, 2016

Member

Just going to note for anyone who wants to work on this that it is not a 2.4 compat bug but probably a 2.3 one (I did not check earlier). @olbrich I am only mentioning this since 9.1.x of JRuby only supports 2.3 and not 2.4. (9.2.x will support 2.4 specific features). So this is fair game right now if anyone wants to take it on.

Member

enebo commented Dec 27, 2016

Just going to note for anyone who wants to work on this that it is not a 2.4 compat bug but probably a 2.3 one (I did not check earlier). @olbrich I am only mentioning this since 9.1.x of JRuby only supports 2.3 and not 2.4. (9.2.x will support 2.4 specific features). So this is fair game right now if anyone wants to take it on.

@olbrich olbrich changed the title from chunk_when not returning results equivalent to ruby 2.4 (jruby 9.1.6.0) to chunk_when not returning results equivalent to MRI ruby 2.3+ (jruby 9.1.6.0) Dec 28, 2016

@olbrich

This comment has been minimized.

Show comment
Hide comment
@olbrich

olbrich Dec 28, 2016

@enebo yeah, it probably is inconsistent with all the MRI rubies that support chunk_while (which I think was introduced in ruby 2.3).

olbrich commented Dec 28, 2016

@enebo yeah, it probably is inconsistent with all the MRI rubies that support chunk_while (which I think was introduced in ruby 2.3).

@olbrich olbrich referenced this issue Dec 29, 2016

Merged

Ruby 2.4.0 #148

olbrich added a commit to olbrich/ruby-units that referenced this issue Dec 30, 2016

olbrich added a commit to olbrich/ruby-units that referenced this issue Dec 30, 2016

Ruby 2.4.0 (#148)
* update build tools to check ruby 2.4.0
* clean up usage of some newer methods for compatibility with older ruby versions
* add notes to readme
* ensure we are using jruby that emulates a ruby 2.* series
* workaround for jruby bug (see jruby/jruby#4410)

@headius headius changed the title from chunk_when not returning results equivalent to MRI ruby 2.3+ (jruby 9.1.6.0) to chunk_while not returning results equivalent to MRI ruby 2.3+ (jruby 9.1.6.0) Jan 5, 2017

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Jan 5, 2017

Member

@cthulhua Hey, feel like taking a stab at this? This was your patch from #3517.

Member

headius commented Jan 5, 2017

@cthulhua Hey, feel like taking a stab at this? This was your patch from #3517.

@cthulhua

This comment has been minimized.

Show comment
Hide comment
@cthulhua

cthulhua Jan 5, 2017

Contributor

Yep, I'll take a look at this

Contributor

cthulhua commented Jan 5, 2017

Yep, I'll take a look at this

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Jan 5, 2017

Member

@cthulhua If it starts to look like it's a problem with JRuby's Enumerable or "native" bits, let us know. We're still dragging along some not-always-correct Java impls of the core Enumerable logic, and these sorts of things are not uncommon to see.

Member

headius commented Jan 5, 2017

@cthulhua If it starts to look like it's a problem with JRuby's Enumerable or "native" bits, let us know. We're still dragging along some not-always-correct Java impls of the core Enumerable logic, and these sorts of things are not uncommon to see.

@cthulhua

This comment has been minimized.

Show comment
Hide comment
@cthulhua

cthulhua Jan 5, 2017

Contributor

It's the same issue with #slice_when that was fixed in a8eff5d

Might be worth consolidating the logic

Contributor

cthulhua commented Jan 5, 2017

It's the same issue with #slice_when that was fixed in a8eff5d

Might be worth consolidating the logic

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Jan 6, 2017

Member

@cthulhua Good catch...I'll give that a shot.

Member

headius commented Jan 6, 2017

@cthulhua Good catch...I'll give that a shot.

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Jan 6, 2017

Member

Ok, I went with @cthulhua's suggestion and combined slice_when and chunk_while logic. This is now fixed.

We may want to look at the Truffle/Rubinius versions of these methods, since we depend on #size being available and they do not.

Member

headius commented Jan 6, 2017

Ok, I went with @cthulhua's suggestion and combined slice_when and chunk_while logic. This is now fixed.

We may want to look at the Truffle/Rubinius versions of these methods, since we depend on #size being available and they do not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment