News for hackers. Stuff that matters.
Re:Pipe Operator (|>) For JavaScript by eknkc on Friday January 20, 2023 @10:34AM (#34454444)
I'm pretty sure this'd be a welcome addition to the language but to be honest, the syntax looks shit.
Re:Pipe Operator (|>) For JavaScript by zmxz on Friday January 20, 2023 @10:42AM (#34454557)
What syntax would you propose or use?
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!
Re:Pipe Operator (|>) For JavaScript by vorotato on Friday January 20, 2023 @12:37PM (#34456631)
hack pipes aren't "pipes" anyway. Every other language that uses |> uses it for functions, not expressions.
Re:Pipe Operator (|>) For JavaScript by kehrin on Friday January 20, 2023 @01:05PM (#34457104)
To be honest |> looks more like a tipped over traffic cone to be begin with.
Re:Pipe Operator (|>) For JavaScript by layer8 on Friday January 20, 2023 @01:31PM (#34457504)
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.

Re:Pipe Operator (|>) For JavaScript by layer8 on Friday January 20, 2023 @06:51PM (#34461930)
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.