An Interest In:
Web News this Week
- April 2, 2024
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
January 20, 2023 11:40 pm GMT
Original Link: https://dev.to/wadecodez/js-pipeline-operator-n5j
JS Pipeline Operator
What are your thoughts on the new Pipeline operator being proposed for JavaScript?
Currently they are working out the flavor of the syntax. Looks like it's between Hack and F# syntax.
Hack Flavor
Provides explicit placeholders. The operation pipes the previous result to the parameter holding the %
sign.
value |> one(%) |> two(%) |> three(%)value |> one('foo', %) |> two('bar', %) |> three('baz', %)
F# Flavor
Provides implicit syntax but could easily be paired with lambdas for more complex pipelines.
value |> one |> two |> threevalue |> x => one('foo', x) |> x => two('bar', x) |> x => three('baz', x)
My Hot Take
Personally I don't like the Hack Flavor. I mainly crave the implicit syntax from F#. Adding an explicit special character to act as a placeholder seems rather annoying.
However, it sounds like the F# flavor comes with some performance pitfalls and could be more difficult to use with async code.
What do you think?
Original Link: https://dev.to/wadecodez/js-pipeline-operator-n5j
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To