Skip to content
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

Proc#curry on lambda with optional param #3011

Closed
tak1n opened this issue Jun 2, 2015 · 5 comments
Closed

Proc#curry on lambda with optional param #3011

tak1n opened this issue Jun 2, 2015 · 5 comments

Comments

@tak1n
Copy link

tak1n commented Jun 2, 2015

I'm currently getting some 2.2 compat done for rubinius and found this bug:

rubinius ➤ ruby -v                                                                                                                                                                                        git:2.2*
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
rubinius ➤ irb                                                                                                                                                                                            git:2.2*
irb(main):001:0> lambda {|a,*b|}.arity
=> -2
irb(main):002:0> lambda {|a,*b|}.curry(3)
=> #<Proc:0x007fdac5168710 (lambda)>
irb(main):003:0> lambda {|a,b=nil|}.arity
=> -2
irb(main):004:0> lambda {|a,b=nil|}.curry(3)
ArgumentError: wrong number of arguments (3 for 1..2)
        from (irb):4:in `curry'
        from (irb):4
        from /home/benny/.rubies/2.2.2/bin/irb:11:in `<main>'


rubinius ➤ bin/ruby -v                                                                                                                                                                                    git:2.2*
rubinius 2.5.5.c97 (2.1.0 4b922b0e 2015-06-02 3.5.0 JI) [x86_64-linux-gnu]
rubinius ➤ bin/irb                                                                                                                                                                                        git:2.2*
irb(main):001:0> lambda {|a,*b|}.arity
=> -2
irb(main):002:0> lambda {|a,*b|}.curry(3)
=> #<Proc:0x2da0 (lambda)>
irb(main):003:0> lambda {|a,b=nil|}.arity
=> -2
irb(main):004:0> lambda {|a,b=nil|}.curry(3)
=> #<Proc:0x2fc4 (lambda)>

Unfortunately this also occurs on jruby, therefore I thought I should report it:

rubinius ➤ ruby -v                                                                                                                                                                                        git:2.2*
jruby 9.0.0.0.pre2 (2.2.2) 2015-04-28 2755ae0 OpenJDK 64-Bit Server VM 25.45-b02 on 1.8.0_45-b14 +jit [linux-amd64]
rubinius ➤ irb                                                                                                                                                                                            git:2.2*
irb(main):001:0> lambda {|a,*b|}.arity
=> -2
irb(main):002:0> lambda {|a,*b|}.curry(3)
=> #<Proc:0x17d0685f@uri:classloader:/jruby/kernel/proc.rb:45 (lambda)>
irb(main):003:0> lambda {|a,b=nil|}.arity
=> -2
irb(main):004:0> lambda {|a,b=nil|}.curry(3)
=> #<Proc:0x3891771e@uri:classloader:/jruby/kernel/proc.rb:45 (lambda)>
irb(main):005:0> 
@tak1n
Copy link
Author

tak1n commented Jun 2, 2015

Seems like rbx and jruby share similar codebases for Proc#curry:
https://github.com/rubinius/rubinius/blob/master/kernel/common/proc.rb#L69-L83
vs
https://github.com/jruby/jruby/blob/master/core/src/main/ruby/jruby/kernel/proc.rb#L3-L17

I will try to send a pr after fixing it at rbx.

@headius
Copy link
Member

headius commented Jun 2, 2015

@tak1n Yes, we share an impl for this logic. Thanks for taking it on!

@headius headius added this to the JRuby 9.0.0.0 milestone Jun 2, 2015
@tak1n tak1n changed the title Proc#curry on proc with optional param Proc#curry on lambda with optional param Jun 16, 2015
@headius
Copy link
Member

headius commented Jul 7, 2015

@tak1n Any progress?

@tak1n
Copy link
Author

tak1n commented Jul 7, 2015

@headius sry hadn't much time lately :(

@enebo enebo modified the milestone: JRuby 9.0.0.0 Jul 14, 2015
@headius
Copy link
Member

headius commented Jul 8, 2020

JRuby appears to work properly now, likely due to fixes leading up to f7d1444 which was included in 9.1.8.0. Marking as fixed as of that release.

If you run into problems in the future, please file a new issue.

@headius headius closed this as completed Jul 8, 2020
@headius headius added this to the JRuby 9.1.8.0 milestone Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants