News for hackers. Stuff that matters.
Re:Pipe Operator (|>) For JavaScript by chadlavi on Friday January 20, 2023 @10:46AM (#34454616)
JavaScript isn't that kind of programming language. I don't know why people are constantly trying to make it something else.
Re:Pipe Operator (|>) For JavaScript by kibwen on Friday January 20, 2023 @10:55AM (#34454768)
Javascript is, without exaggeration (and with much chagrin), the language that has done more to popularize functional programming than any other programming language in history. It's only natural that they'd continue pushing on that front. :P
Re:Pipe Operator (|>) For JavaScript by gerad on Friday January 20, 2023 @11:01AM (#34454886)
Second most after spreadsheets
Re:Pipe Operator (|>) For JavaScript by aclatuts on Friday January 20, 2023 @11:11AM (#34455101)
Yes I took a functional programming course with Racket. But in hindsight Javascript made me appreciate and understand functional programming way more.
Re:Pipe Operator (|>) For JavaScript by BeefWellington on Friday January 20, 2023 @11:58AM (#34456004)
This was by accident though.
Re:Pipe Operator (|>) For JavaScript by nerdponx on Friday January 20, 2023 @10:47AM (#34454648)
My pet theory:

Front-end devs are generally stuck with JS, but they wish they were able to use other languages, but they can't, and can't convince their managers to use Clojurescript or Purescript, so this is what happens.

What's bonkers to me is that ECMA would prefer to keep adding features like this instead of adding a macro system.

Re:Pipe Operator (|>) For JavaScript by eddsh1994 on Friday January 20, 2023 @11:14AM (#34455164)
JavaScript with macros? Please please no. Can you imagine that?
Re:Pipe Operator (|>) For JavaScript by yakshaving_jgt on Friday January 20, 2023 @08:48PM (#34462927)
I'm not buying that theory. I'd love if more front-end developers were eager to use PureScript or Elm, but popular sentiment appears to be that anything other than JavaScript is weird or hard or impractical or unreadable.
Re:Pipe Operator (|>) For JavaScript by prmph on Friday January 20, 2023 @10:58AM (#34454824)
But clearly we need "that kind of programming language" for rich client web apps. We need many of the modern language constructs in such a language. Would you advocate for an entirely new language to meet that need?
Re:Pipe Operator (|>) For JavaScript by chadlavi on Friday January 20, 2023 @01:26PM (#34457422)
This is perhaps a controversial opinion, but I don't think that you need this at all to do programming. This is just syntactic sugar! Type some parentheses and move on.
Re:Pipe Operator (|>) For JavaScript by prmph on Sunday January 22, 2023 @03:32PM (#34481905)
Then we might as well give up async/await, promises, generators, recursion, null coalescing, and more.

After all, they are all “syntactic sugar”, right?

Re:Pipe Operator (|>) For JavaScript by dmak on Friday January 20, 2023 @11:28AM (#34455428)
Why do you think it's not?
Re:Pipe Operator (|>) For JavaScript by bakugo on Friday January 20, 2023 @11:00AM (#34454864)
There is an increasingly large population of "programmers" that have never known anything other than Javascript and don't understand the concept of "different languages for different purposes". They want Javascript to do everything so they don't have to leave their comfort zone.
Re:Pipe Operator (|>) For JavaScript by no_wizard on Friday January 20, 2023 @12:29PM (#34456486)
I can't say I blame us, as its the utility lingua franca for UIs, especially with cross platform UIs via React Native or NativeScript.

Web browsers are a long ways off from WASM being acceptable as an alternative in most cases, as it yet can't access the DOM directly.

Its not that we don't understand different languages for different purposes, its more what real alternative do we have here and if we want certain features in the language we have to follow the process to get them.

Re:Pipe Operator (|>) For JavaScript by runald on Friday January 20, 2023 @11:18PM (#34463840)
"There is an increasingly large population of "programmers" that have never known anything other than Python and don't understand the concept of "different languages for different purposes". They want Python to do everything so they don't have to leave their comfort zone."

Also, s/Javascript/$LANG_YOU_HATE/g

Re:Pipe Operator (|>) For JavaScript by hyperhopper on Saturday January 21, 2023 @09:03PM (#34473357)
What does that mean?

1. Javascript is at its core a functional programming language. In many ways it is more like lisp than like java (and lisp was the original intended syntax for javascript!) 2. Adding pipe operators is 100% in line for a functional programming language. 3. Even if it weren't, adding functional features to a high level language is definitely a good thing.