3 ms·
I had mixed results in the past when I tried to use currying in Javascript. The stack traces were cluttered by references to the currying function and it also m
by ufo 6y ago
I had mixed results in the past when I tried to use currying in Javascript. The stack traces were cluttered by references to the currying function and it also masked bugs if you forgot to pass an argument. Without currying, if you pass less arguments than the function expects then you usually get an error right away complaining that the argument is undefined. However, if the function is curried then it silently succeeds. You only notice the problem later, when you try to use the return value and realize that it is actually a function. To make things worse, when this happens the stack trace points to the place that is trying to use the return value instead of pointing to the function call that is the actual source of the problem.
My final impression was that currying works better a language like Haskell that has a strong type system. In a dynamic language it is more problematic.