Hacker News new | ask | show | jobs
by eddsh1994 1183 days ago
Can it really be called the wrong tool when so many huge businesses and essentially the entire globe are powered by it? It’s certainly worked imo
8 comments

I'd bet good money you could go back in time and swap out JS with just about any relatively high-level language (maybe the original Scheme plan, maybe Java, literally anything with managed memory) and that language would enjoy JavaScript's popularity today.

JavaScript's ubiquity has everything to do with its monopoly in the browser, and nothing to do with any specific features of the language.

That was once true.

But Javascript has grown into a language that makes some solid and unique trade-offs including its simple single-threaded concurrency, modern language features, async-everything, first-class Promise, and Typescript.

"Javascript sucks and people only use it because they have to" is both wrong and boring. We, as a community, have to stop trotting out this tired comment any time a submission has the word Javascript in it.

TypeScript is not a feature of JavaScript, and the ability to have single-threaded IO event loops is far, far, far from something modern, unique or remarkable about a language, the fact that it's limited to single-threads actually makes it something you really do not want to bring up as a "pro" but rather as "it's something you'll have to keep in mind".
Typescript is certainly a feature of the Javascript ecosystem. Typescript's success and maturity easily puts it ahead of other dynamically-typed languages that tried to bolt on static typing support. Not including TS with JS just seems like a pointless "well actually" quibble.

Single-threaded + async-everything is a unique and powerful feature of Javascript. You might not like it every time, but it's useful most of the time. Most other languages make it easy to write single-threaded but blocking code where you need to reach for an extra solution to write async code, and not everyone needs to even use the same solution, and it doesn't necessarily work with the default blocking ecosystem.

We take that for granted in Javascript.

Once again, this is a very tired thread. Sometimes you just have to admit there are trade-offs and that you aren't going to have a taste for every decision on every trade-off every time. And that's okay.

Nobody in this thread is even interacting with TFA.

It’s a feature which follows from how web browsers work.

I agree with above comments that you could have taken any language. But you have a point, making async mandatory is a powerful thing.

This could have been done to any language tho, Java, TCL, Scheme, whatever.

Tcl already has built-in event loop and async programming features.
I don't think JavaScript sucks. But it certainly did suck when in it was first introduced, and it only got better because of the "I have to use it" -> "I'll fix the worst mistakes" -> "still kinda sucks" -> repeat loop that was enforced by its monopoly on the browser space. Any language in its situation would have been refined at least to the level of mediocrity we enjoy in JavaScript today.

If you look at the post I replied to, I was countering the idea that "JavaScript must be good because lots of people use it". JavaScript is popular today because it was popular yesterday, and the roots of that chain is JavaScript was popular in late 90's because it was your only real choice.

I've used actually bad languages professionally. JavaScript today is merely mediocre, thanks to nearly 30 years of fixing. But it's still held back by its roots of being kinda awful. There are unambiguously better choices for non-browser codebases, unless "whatever is popular" is a primary driver.

I (ignorantly) thought of Python as JS with more syntactic sugar, but after I switched over I realized that JS has very little intentional design- its a random collection of features and quirks that invites you to shoot yourself in the foot. I mean just let,const, var and declaring a variable with no keyword at all is a huge mess.
>is both wrong and boring.

I'm not sure how someone's statement of personal motivation can be wrong? Here is mine: JavaScript doesn't suck. However I personally do "only use it because I have to", i.e. because of the browser support. Nothing more. Where's the "wrong" in that? I'm not lying to you. I promise.

And JavaScript isn't alone! There are many more languages I think are simply okay, and don't suck. Several of those I have used professionally because I had to, but would not choose them for a personal project. I would also use them if they were all a web browser ecosystem supported.

> stop trotting out this tired comment

I totally get this sentiment because I feel it myself with some topics. But to give you another perspective: the comment and issue keeps coming up because in the eyes of some (many?) the problem hasn’t been solved.

It’s like I’m getting pin pricked every day so I keep complaining about it.

There's a pretty big gap between "this tool is so bad it's impossible to use" and "this tool is quite bad but determined people can still make it work"—my experience is that the latter is totally sufficient for a tool to go mainstream, but it can still be fair to call it the wrong tool :P
"Essentially the entire globe" is way off. In the web world, yes, and some niche people doing stuff with JS because they can, maybe. I don't think you find much, if any, of it in cars, planes, telecom, robotics and other areas of computing. Correct me if I'm wrong, though.

And just because something is ubiquitous doesn't mean there doesn't exist anything better.

Can any situation that exists in the world be bad? Yes, indeed. If anything, the ubiquity of JavaScript makes its shortcomings a worse problem than if JavaScript weren't so widespread.
You don’t need excellence to have a profitable company, and in fact once you get to about 80% of excellence you make less profit the higher you go.

Businesses/industries being huge does not indicate whether a tool/method/approach is high-quality.

It powers the web, because there are no other options. If JS was good, people would use it for other things.

Terminal apps, trading algos, operating systems, compilers, embedded, databases, etc etc.

JS is never the best tool for the job. But sometimes, it's the only one.

Sure. Multi-megabyte download that display a spinner while fetching data to display a web page. But hey, billions of flies cannot be wrong
Might be despite of it.