Hacker News new | ask | show | jobs
by Dude2023 3020 days ago
> This is because JS is a good choice for most things.

That's why it's one of few languages: 1) with mainstream transpilation; 2) more than one transpiler.

4 comments

Isn't that simply because, until recently, JS had a "monopoly" on languages you could use inside a browser?
If you look at it as "compilation tends to converge on the lowest-level possible output", it all fits pretty well. Dynamic scripting languages flouted that for a long time, but now there's enough JITs floating around that show that even they tend in that direction.

So if JS is the lowest possible level language, than that will be the compilation target for a program going into that context.

x86 has its many, many critics, but I've never heard any of them say that x86 is bad because so many things compile to it....

Yes, that's the only reason anyone has voluntarily used JavaScript.
This, is false. for many (some, if you prefer) use cases javascript is perfect.
The only reason JS is popular is because it holds a monopoly in the space it operates in.

There are so many superior languages to it.

Jeez, this horse always gets beaten to death, twice. We get it. You hate JS. ${language_of_choice} is better because [Reasons].

In the end, it doesn't matter. JS is here to stay. If you don't want to write it, don't write code for projects that need it. Constant complaining about its faults does nothing at all except produce noise in threads like this.

And, fwiw, I don't see too many C projects for Front-end solutions like e.g. React. Maybe that means JS is a superior language in the context of the problem is was made to address. Holy shit! Who would have thought that "it depends" applies to development?!

A bit defensive, aren't we? I didn't see OP say anything about hating JS, just that it only got popular for the wrong reasons.
> Maybe that means JS is a superior language in the context of the problem is was made to address. Holy shit! Who would have thought that "it depends" applies to development?!

Only in terms of access/availability but that was his point...

It's the only language supported by web browsers. That's the reason people still use it.
So how do you explain Node.js being so popular?
Because frontend devs migrated to the backend and didn't want to learn a better language.
Suggesting tha Node is only used by lazy front-end developers does nothing but show how condescending and uncharitable you are towards other people who picked different trade-offs than you.
Not wanting to learn a different language is a justifiable preference. Software is full of cost/benefit questions like that. Believing true things also doesn't make you uncharitable.
And those of us who went to it from those ostensibly "better" languages...?

Go on. Say we're "wrong". I could use a chuckle. :)

What about, we need to pimp up our CVs for HR department drone filters?
Not wanting to use those better languages is effectively the same in this case. But you mentioned it being wrong first...
Because I'm rather tired of the silly claims. I write Rust. I write Kotlin. I write C++. I write Ruby. And I also write JavaScript. Horses for courses--and the mind-meltingly stupid sneering nonsense should just end. Just...end.

I used to smarm about it. I was wrong to. You should stop, because you are wrong now.

Ryan Dahl wanted to replicate the nginx "async" model for normal web development. Since javascript was single-threaded, it pretty much forced an asynchronous programming model and many of the libraries were already built that way, so it proved to be a fertile ground for experimentation.

In other words, we have node.js and not node.xxx because other languages at that time did not provide a suitable ecosystem for building asynchronous programs. Today most languages have much better async support, or they have features (like goroutines in golang) which achieve the same objective in a different way.

Emphasis on ecosystem. I remember working with netty and other platforms that provided async networking years before nodejs got popular and asnyc became "trendy".
Doug Schmidt's C++ Reactor and Sam Rushings Python Medusa did async networking 20 years ago. But in the late 90s and early 2000s a lot of J2EE based server code was built in Java that used one blocking thread per client; that was a major wrong turn in mainstream SW design that took a long time to correct, IMHO.
Well, how many other languages are sent over the wire to be interpreted on a ubiquitous client that's been incrementally changing for decades?

Is it a mystery to you why this situation is different from your favorite language that you aren't source-to-source compiling?