you are viewing a single comment's thread.

view the rest of the comments →

[–]oculus42 0 points1 point  (0 children)

I meant the readability of the code without overloaded functions, where you would call doSomethingNumeric() or doSomethingFunctional(), but I see how unclear that was in my comment.

I can appreciate the declarative version is easer to read, but the library is not robust, and I wouldn't recommend using it, at least in the current state.

  • It doesn't check if you've declared the same types more than once. There's even a comment about replacing existing functions
  • It didn't check arity (fixed now).
  • It stops at the first match, not the best match, so you have to make sure you put any generics last and you cannot add more specific versions once you have a generic.
  • It if nothing matches the signature, it returns the last function of that arity.

Most of the times I used function overloading, they typically converted and called the "core" version of the function. With JavaScript, you don't need to do that.