Hacker News new | ask | show | jobs
by gloosx 25 days ago
If javascript is not a solid foundation to build anything on, then how come everything is built on top of it? It's the language powering the whole web, and people went really really far with it. Besides that, almost every major programming language can now run in the browser via webassemly, which solves problems in the areas where javascript is lacking raw performace.
4 comments

Your parent comment already answered that.

You're mistaking "JS is forced on people and they have no choice but to make it work" with "it's everywhere so it must be good".

JavaScript wasnt forced on people any more than HTML or CSS were. Browsers standartised on a common scripting language so that websites could work consistently across implementations. You can build websites without JavaScript, modern HTML and CSS can accomplish quite a lot on their own.

And there is absolutely nothing stopping anyone from developing a browser that natively supports another scripting language. Your arms are untied to end the javascript tyranny once and for all.

Finding it hard to take such wildly idealistic comments seriously.

There's a ton of stuff that will stop you from making your own browser. The distinction here is that nobody is stopping you to BEGIN making your own browser, but dozens of factors will stop you from making it WIDELY VIABLE later -- which you need if you want anybody else but you to use it.

I think you got hung up on "forced". Obviously nobody is saying that pistols put at somebody's forehead were involved. But IE6 and "This browser is not supported" was a thing back then, and that made people compromise a lot and appeal to early JS stupidities.

Then it snowballed and the rest is history.

Speaking of which, it took CSS ages until its devs finally woke up and started adding native animations and transitions for which JS was required. So you were "forced" using JS for those for quite a long time as well.

Don't argue linguistics, please. I'm very sure you knew exactly what I was talking about.

> how come everything is built on top of it

Everything is not built on top of it.

> It's the language powering the whole web

It’s also not powering the whole web, just a significant part of the client frontend inside browsers.

Because you have no choice?
What would that choice look like in practice? Should every browser vendor implement and maintain a dozen different language runtimes with all the associated compat and security implications? Standartising on a common scripting language seems like a pretty reasonable engineering decision, and abadoning that standard after decades of widespread adoption seems like a pretty shitty engineering decision.
> What would that choice look like in practice?

Allow WebAssembly to directly access the DOM, so you can write whatever language you want and compile it to WebAssembly.

This implies the massive complexity of restructuring how browser engines work, plus working around security and memory safety issues. And this work is actually being done right now, see wasm GC and Component Model
> how come everything is built on top of it

Can you share something else they could've built everything else on top of, instead? Yeah, that's what I thought.

Do you really think a normal junior dev is going to be/should be writing web assembly code to build a basic portfolio website?

You have made an extraordinary claim, considering an enormous amount of complex, reliable software written in JS. Perhaps first you could explain what exactly makes it an unsuitable foundation for building software?

Im also curious what language do you think would be suitable instead? And whats your plan to move all the browsers and websites in the world to this new language?

> Perhaps first you could explain what exactly makes it an unsuitable foundation for building software?

https://i.redd.it/rz3o1yibnc511.png

> And whats your plan to move all the browsers and websites in the world to this new language?

I'm not proposing this, I am saying there should have been options to begin with.

Sorry but tired old JS "gotchas" that no developer worth a damn would ever use, is not a valid reason to shit on Jacascript. Every language has stupid footguns.
> no developer worth a damn would ever use

There are a lot of junior developers across the world in different economic situations who might. To think otherwise is just arrogance. Think students, freshers, job-seekers switching industries.

In other words, if your programming language makes it easy for you to shoot yourself in the foot, then it isn't a good programming language to begin with.

Sorry but there is no perfect programming language, there isn't even one that doesn't confuse "students, freshers, job-seekers switching industries". This magical perfect programming language you seem to think exists simply doesn't exist. In fact, Javascript is far easier than most languages for people new to programming to learn. It was designed that way, and it works well in that role. Invariably, it's only people trying to be gatekeepers are the ones who try to shit on javascript, especially by citing "gotchas" which aren't even really "gotchas". People new to javascript and programming sure aren't the ones who try to shit on it.