Taken from D2768.
This replaces our function wrapper code with pure-template code. They would become neater come C++17 but they already work well.
- Any number of argument, so long as they are convertible to/from JSVal (or are themselves JS::Values)
- Any return type, same criteria, including void
- Works with free functions and as object properties -> can use a custom "this" getter, so we can clean up things in a bunch of places (haven't done so yet).
- I don't think optional arguments work, and they apparently do in svn? Not sure.
- Functions that have overloads can't be called -> it's ambiguous. Might be solvable too with a fancy wrapper, but I'm not sure it's worth it.
There is no need to specify argument types anymore, however for the moment I'm using the ptr type and the pointer... I might find a way around that.
I think the changes mostly speak for themselves.