> I'm not missing the point, and I don't agree that it hides an error and gives a cryptic bug.
It hides the error by carrying on, despite having the wrong number of arguments, and executing code with thus necessarily wrong inputs.
> Messing with a function signature and not updating callers of that function is not a bug in the language, it's a bug in the programmer
When editing code, you routinely change the function signatures of hundreds of functions. Of course you're going to miss some, some of the time. Human errors happen, and good languages help us deal with them.
Also, every time you pull code from another repository, function signatures all over the place change. Some of those may be functions your currently edited code is calling. This means every little divergence requires reviewing every single signature change or cryptic bugs will result.
> and will result in runtime bugs in any dynamic language.
It will result in runtime errors in dynamic languages. Errors that are visible, and difficult to ignore. That means the code gets fixed. UT triggers it trivially.
Whereas with Javascript, even code under UT can easily pass accidentally when wrong numbers of arguments are used.
This Dijkstra quote is relevant:
> It was a significant improvement that now many a silly mistake did result in an error message instead of in an erroneous answer. (And even this improvement wasn't universally appreciated: some people found error messages they couldn't ignore more annoying than wrong results, and, when judging the relative merits of programming languages, some still seem to equate "the ease of programming" with the ease of making undetected mistakes.)
> If you require X number of args, then assert that they aren't undefined
That captures half of the bugs (too few arguments), for a large overhead (an extra line for almost every argument in every function).
> If you presume callers pass in X number of args in a variable args language, and then change the required args, you're the bug, not the language
Every time you change code, there is potential to insert bugs. Of course all bugs originate from programmer errors. The tools can work with us to find these errors and mitigate them, or they can give us hell.