3 ms·
I'm really not a fan of the function bind operator. It adds extra complexity to the meaning of "this" in JS, which is already one of the most confusing aspects
by Sonata 10y ago
I'm really not a fan of the function bind operator. It adds extra complexity to the meaning of "this" in JS, which is already one of the most confusing aspects of the language.
I do understand that it is nice to be able to write those chained method call pipelines, without having to monkey patch anything. I think the |> operator from Elixer is a much simpler solution to this problem through, as it allows you to use normal functions, rather than having to write special versions that use 'this' for their primary data.
- codecurve 10y agoTotally hear what you're saying and I think JS would be better off without `this` in the first place. Clojure's threading macros are another great solution to the chaining problem. That said, `this` is here to stay and to me, function bind feels like a pretty great way to write code that feels natural, without the danger of extending the prototypes for Array and Object.