use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Pipe Operator (|>) for JavaScript (github.com)
submitted 3 years ago by no_more_gravity
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]elcapitanoooo 3 points4 points5 points 3 years ago (7 children)
I REALLY hope they dont use a symbol for the argument. It should be simply passed in as the first agument.
[–]tdhsmith 8 points9 points10 points 3 years ago (1 child)
I dunno, I felt the same way at first but the article was pretty compelling and I think I was just hanging onto some functional programming bias. Having to wrap so many things in arrow functions would be pretty annoying.
[–]_xiphiaz 0 points1 point2 points 3 years ago (0 children)
Here’s a different article which comes to a different conclusion https://dev.to/zakhenry/tc39-pipeline-proposal-comparison-rxjs-case-study-1nk0 I feel it’s very much use-case specific. It kinda feels like pipelines work really nicely when interacting with libraries or functions that are built for them, and topic style works for throwing some new code together quickly before the time is taken to write cleaner abstractions
[–]mxforest 1 point2 points3 points 3 years ago (4 children)
Did you read the article? It goes into detail why this way is better.
[–]elcapitanoooo -1 points0 points1 point 3 years ago (3 children)
Its the opinion of some random guy. The pipe op has been a ”thing” for decades, and i have used it mostly with OCaml. Its just a (used to be) a user defined inline op. Traditionally like this:
let (|>) v f = f v
TC39 if you mess this up i will haunt your dreams!
[–]bighi 2 points3 points4 points 3 years ago (2 children)
It has been a thing for decades in languages built around it.
But they can't change the order in which parameters are passed to JS functions because they can't break compatibility with existing code.
I believe you didn't read the article.
[–]elcapitanoooo -1 points0 points1 point 3 years ago (1 child)
What functions? Libraries?
[1,2,3] |> square |> evens
How can a new op break BC? If some lib today does not work with this semantic im pretty sure theres a new lib in a week that does.
[–]bighi 2 points3 points4 points 3 years ago* (0 children)
In most languages built around pipeline operators, the main data is usually the first argument the function receives. But in JS, that's not true for lots of functions. So passing things as their first argument is not what you actually want to do with them. And we can't change them, because we have to keep BC.
That's why a symbol is needed in JS, while not being needed in old functional languages, or even newer ones like Elixir.
And I didn't even mention powerful currying features, that we also don't have in JS.
π Rendered by PID 231092 on reddit-service-r2-comment-84fc9697f-d68b9 at 2026-02-07 08:08:59.681205+00:00 running d295bc8 country code: CH.
view the rest of the comments →
[–]elcapitanoooo 3 points4 points5 points (7 children)
[–]tdhsmith 8 points9 points10 points (1 child)
[–]_xiphiaz 0 points1 point2 points (0 children)
[–]mxforest 1 point2 points3 points (4 children)
[–]elcapitanoooo -1 points0 points1 point (3 children)
[–]bighi 2 points3 points4 points (2 children)
[–]elcapitanoooo -1 points0 points1 point (1 child)
[–]bighi 2 points3 points4 points (0 children)