Easiest is to just do it by hand: foo(args[0], args[1]);
This can also be automated with a bit of code in a lot of cases:
import std.traits;
ParameterTypeTuple!foo params;
foreach(index, ref param; params) {
params[index] = args[index];
}
foo(params);
Move that into a helper function and you can call it apply.
You could also make that assignment in the loop to type
conversion if you wanted, my jsvar.d does this to provide
javascript-style functions with an apply method.
