Another problem with currying in Javascript is that it leads to more complicated stack traces, which is unfortunate for debugging.
Another problem with currying in Javascript is that it leads to more complicated stack traces, which is unfortunate for debugging.
The OP is already using Function.length (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...), so I suppose one could roll their own arity-checking. It'd be a little out of sync with the rest of the language, though.
If you have an uncurried function for which you have not supplied sufficient arguments, and it is eagerly evaluated, you more likely see below the call site an error in the function where an expected value is undefined. If the function is curried, the meat of the function remains unevaluated, and so is sure to give you back a value that isn't the one you want. So it does seem like moving to currying in JS is likely to sometimes increase error-to-symptom distance.
Does currying even make sense for variadic functions? I can't imagine what that would look like as an implementation.
This example here is a function that sums a variadic list of non-zero numbers. The zero signals the end of the list.
Its certainly very weird though. I wouldn't recommend doing this in real programs.