Object#instance_exec only works with blocks of 3 parameters or less?!
---------------------------------------------------------------------

                 Key: JRUBY-3490
                 URL: http://jira.codehaus.org/browse/JRUBY-3490
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1.6, JRuby 1.1.4, JRuby 1.2
         Environment: Sun Java 1.5 on Linux, OS/X
            Reporter: Sam Coward
         Attachments: jruby_instance_exec.patch

Once you go above 3 arguments, it seems instance_exec breaks down.  

{code}
$ jirb
irb(main):001:0> block = Proc.new { |a,b,c,d| a+b+c+d }
=> #<Proc:0xf73893@(irb):2>
irb(main):002:0> instance_exec(1,2,3,4,&block)
ArgumentError: wrong # of arguments(4 for 3)
        from (irb):3
irb(main):003:0> block = Proc.new { |a,b,c,d,e| a+b+c+d+e }
=> #<Proc:0xc6a374@(irb):4>
irb(main):004:0> instance_exec(1,2,3,4,5,&block)           
ArgumentError: wrong # of arguments(5 for 3)
        from (irb):5
{code}

I tried the attached patch, which adds rest=true to the JRubyMethod, allowing 
it to accept any number of arguments.  I'm not quite sure if there was some 
reason why optional=3?



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to