Re:Pipe Operator (|>) For JavaScript
by zmxz on Friday January 20, 2023 @10:42AM
(#34454557)
What syntax would you propose or use?
[ Parent
| on HN ]
Re:Pipe Operator (|>) For JavaScript
by galaxyLogic on Friday January 20, 2023 @11:18AM
(#34455239)
I would propose -> instead of |>
Re:Pipe Operator (|>) For JavaScript
by CodexArcana on Friday January 20, 2023 @11:42AM
(#34455688)
but then is not a pipe!
hack pipes aren't "pipes" anyway. Every other language that uses |> uses it for functions, not expressions.
To be honest |> looks more like a tipped over traffic cone to be begin with.
It’s a horizontal pipe. It arguably actually makes more sense when the values flow horizontally from left to right through the pipe.
In an alternative universe, Unix shell syntax may have used “—“ instead of “|” for piping.
PS: The commands in Unix pipes are executed in parallel, and “|” could be interpreted as a mnemonic of that fact. However, the same is not true for the programming-language feature discussed here, which only processes singular values, not streams.