1. 1
  1. 1

    A higher-order function that proxies context to context free functions.

    What does that mean though?

    It sounds like a “context” is given to “context-free” functions. But are they actually context-free, then?

    What does this accomplish where just calling the standard bind method wouldn’t suffice?

    1. 2

      It’s probably bad and likely eliminates referential transparency.

      1. 1

        Context here means the this binding of a function. If you start with a desire to write pure functions and to structure your program as a composition of pure functions, then you want to avoid the this keyword. Functions that use this are impure. But sometimes this is unavoidable. For example, you might be writing a lifecycle method for a React component and need a value from this.props. In that case, you need an abstraction which provides those values to your pure function as arguments so the pure function doesn’t lose its purity. A higher-order function is one way to create that abstraction. If you just want to change a function’s this binding then Function.prototype.bind is definitely all you need.