Live data from Hacker News

The JavaScript Pipeline Operator

yanis.blog

61–63 of 63 posts

Re: The JavaScript Pipeline Operator

#61
post #25

FWIW, several language communities call this "the Thrush combinator"[0]. Armed with that term, searching the web for background/info/theory on this topic will be easier. 0 - https://debasishg.blogspot.com/2009/09/thrush-combinator-in-...

Thanks! Sounds a bit too scientific to my ear but good to know

It is what it is, and what it is in JavaScript is this:

  Object.prototype.pipeTo = function (functor) {
    return functor (this);
    };

  function inc (input) { return input + 1; }

  // this will write out "2" to the console log
  new Number (1).pipeTo (inc).pipeTo (console.log);

HTH

Re: The JavaScript Pipeline Operator

#63
post #32
post #4

ES6 was needed, but I think js should hit the breaks for new language features for a while.

I disagree. ES6 made JS much more palatable but it's still behind most modern languages in terms of number of features and in velocity of new features getting introduced. Javascript has actually been extremely slow to get new features compared to other languages. Since ES6 (3 years ago), the only major, mainstream feature that has been added to JS has been async functions, which are awesome, but in that time Python (…

Velocity of new features being added is not a metric of quality.
Post reply on HN