News for hackers. Stuff that matters.
Re:TC39 Pipeline Operator – Hack vs. F# by the_duke on Tuesday September 14, 2021 @05:42PM (#28531771)
Chained function calls only work if the types in question have immutable functions that support chaining. This is the case for arrays with `map`, `filter` and for promises with then/catch.

But it's not the case for the majority of libraries, including many of the builtin types.

A pipeline operator is generic and can be used everywhere, without requiring the API to be built around chaining. This can often lead to much nicer, more readable code.

I think this is something you only start to really appreciate once you've used it a bit, like in Elixir or F#.

Obviously this is much more natural in a functional language, where everything is immutable anyway.

There are no comments on this comment yet.