On 10/24/2013 02:54 PM, Raphaël Amiard wrote:
Is there a way to avoid the overhead of creating the args table forevery call? What other optimizations are possible? From what I'm seeing you don't need a table, all you need is, well, runtime checks.
<snip>
Runtime checking the number of args passed is a bit more tricky, but can still be done easily by adding a parameter to the compiled function. Our previous example def f(a=0, b=12): # code here then becomes function f(num_args, a, b) if num_args > 2 then raise an error end if b == No_Arg_Passed then b = 15 end end
This is a good idea, which I plan on stealing. -Justin