[MacRuby-devel] Globbed method arguments (splat) Limit

John-Paul Bader hukl at berlin.ccc.de
Sat Sep 5 03:11:12 PDT 2009


Hey guys,


a friend of mine implemented a heap in ruby for educational purposes.  
He did so with several implementations. He had a few benchmarks and I  
suggested to run them on macruby to see how well it would hold up.

Unfortunately we didn't get really far because apparently there is a  
problem with globbed/splatted method arguments in macruby which raises  
an exception if more than 199 arguments are passed.

Can be tested easily with:

def foo(*bar); puts bar.length;end
1.upto(1000) {|x| foo(*([0]*x))}

In vm.cpp:2977 #define MAX_DISPATCH_ARGS 200 is defined and a big fat  
todo is right below it addressing this issue. Now I know its not a  
super urgent problem because its not what you do in ruby every day.  
Still its obviously something that has to change.

In line 3003 there is this assert: assert(real_argc + count <  
MAX_DISPATCH_ARGS);  so it must be important i guess.

So i'm just wondering why it is limited to 200 in the first place and  
if there is something I can to even though I'm not really a capable  
(objective) c programmer ?


After commenting out the code with the globbed arguments the  
benchmarks on the remaining tests ran a bit slower than on ruby 1.9.1.


Kind regards, John


More information about the MacRuby-devel mailing list