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

Hash#select! inconsistency with MRI when yielding only one argument #3137

Closed
robin850 opened this Issue Jul 15, 2015 · 6 comments

Comments

Projects
None yet
3 participants
@robin850
Contributor

robin850 commented Jul 15, 2015

Hello,

There's a tiny behavioral difference between MRI and JRuby regarding the Hash#select! method when there's only one argument passed to the method's block:

>> h = {a: :b}

>> RUBY_ENGINE
=> "ruby"
>> h.select! { |k| p k }
:a

>> RUBY_ENGINE
=> "jruby"
>> h.select! { |k| p k }
[:a, :b]

The problem seems to be in keep_ifCommon ; I tried to write a fix but I haven't been able to.

Have a nice day!

@kares

This comment has been minimized.

Show comment
Hide comment
@kares

kares Jul 15, 2015

Member

you mean JRuby 1.7.x right? ... there's been a similar issue with take_while

Member

kares commented Jul 15, 2015

you mean JRuby 1.7.x right? ... there's been a similar issue with take_while

@robin850

This comment has been minimized.

Show comment
Hide comment
@robin850

robin850 Jul 15, 2015

Contributor

@kares : Actually I did not test with 1.7, just with JRuby 9000

Contributor

robin850 commented Jul 15, 2015

@kares : Actually I did not test with 1.7, just with JRuby 9000

@kares

This comment has been minimized.

Show comment
Hide comment
@kares

kares Jul 15, 2015

Member

quick test - 1.7.x behaves fine (compatibly with MRI 1.9.3) thus marking as 9K :

jruby-1.7.20 :001 > h = {a: :b}
 => {:a=>:b} 
jruby-1.7.20 :002 > h.select! { |k| p k }
:a
Member

kares commented Jul 15, 2015

quick test - 1.7.x behaves fine (compatibly with MRI 1.9.3) thus marking as 9K :

jruby-1.7.20 :001 > h = {a: :b}
 => {:a=>:b} 
jruby-1.7.20 :002 > h.select! { |k| p k }
:a

@enebo enebo added this to the JRuby 9.0.1.0 milestone Jul 15, 2015

@enebo

This comment has been minimized.

Show comment
Hide comment
@enebo

enebo Jul 15, 2015

Member

This one is non-trivial to fix atm but it is pretty important so we will target this (along with several other block parameter bugs for first point release after release.

Member

enebo commented Jul 15, 2015

This one is non-trivial to fix atm but it is pretty important so we will target this (along with several other block parameter bugs for first point release after release.

@enebo enebo modified the milestones: JRuby 9.0.1.0, JRuby 9.0.2.0 Sep 2, 2015

@enebo enebo closed this in 303a128 Oct 14, 2015

@enebo

This comment has been minimized.

Show comment
Hide comment
@enebo

enebo Oct 14, 2015

Member

yieldSpecific with two args to a proc which receives one arg is broken atm but I changed these all to yieldArray. I would try and fix yieldSpecific but we have a much larger task for blocks and it will get handled then.

Member

enebo commented Oct 14, 2015

yieldSpecific with two args to a proc which receives one arg is broken atm but I changed these all to yieldArray. I would try and fix yieldSpecific but we have a much larger task for blocks and it will get handled then.

@robin850

This comment has been minimized.

Show comment
Hide comment
@robin850

robin850 Oct 17, 2015

Contributor

Thanks for fixing this !

Contributor

robin850 commented Oct 17, 2015

Thanks for fixing this !

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