This is definitely a super noob question and possibly misguided. I don't work front end at all. But I am quite aware of the mountain of frameworks built on JavaScript to support modern web applications.<p>I was reading up on WebAssembly and how one of its intentions was to allow people to write browser code in other languages of their choice. However it seems that is proving to be quite difficult and you still have to fall back on JS at some point.<p>It got me thinking why don't Google, Mozilla, Apple (and Opera?) come together and build a non-JS interpreter into the browser? Google apparently tried to put Dart interpreter into Chrome but gave up somewhere along the way. So it seems possible, but just a matter of tremendous effort.<p>Obviously right off the bat I can think of dozen issues with this suggestion.<p>- This is huge engineering task, maybe impossible to achieve. Maybe it not feasible to have more than one interpreter in a browser without crashing the entire system.
- Maybe big browser vendors have no interest in doing so. They actually prefer JS?
- JS is actually fine, and any other language runtime will run into the same issues.<p>I am just looking for someone to explain to me at a high-level why this is a terrible idea. Thanks!
Early on, in the browser wars of the 90s, this WAS what they tried. Netscape and Sun worked together to bring Java to the browser, leading to infamous "applets" that would take forever to load and have terrible UX, etc., but that ran in the browser in Java.<p>Then they decided to create Javascript to give the browser itself a scripting language, then Microsoft copied them with JScript and VBScript, then Macromedia (later Adobe) made Shockwave and Flash, then Microsoft made ActiveX and later Silverlight... but plain old Javascript remained the lowest common denominator that ran everywhere and eventually overtook all the other attempts.<p>Then when half the users moved to Android and iOS instead of web browsers, well, they each have their own native stacks that completely bypass the Web. And these days there are wannabe-native-for-web-devs like React Native, so even less of a reason to add another language to the Web proper, I guess.
Because outside of a few really passionate people who hate JS with all their heart, the rest of us are really just fine using JS. It's a fine language. It does the job. Sure it can be better - everything can be better, but is it worth the cost to switch to something else?
JS isn't perfect, but it's good enough. And there is ongoing effort to make it even better.<p>Also, many other languages compile to JS (without WASM). Notably:<p>- <a href="https://www.typescriptlang.org/" rel="nofollow">https://www.typescriptlang.org/</a><p>- <a href="https://coffeescript.org/" rel="nofollow">https://coffeescript.org/</a><p>- <a href="https://clojurescript.org/" rel="nofollow">https://clojurescript.org/</a><p>- <a href="https://www.transcrypt.org/" rel="nofollow">https://www.transcrypt.org/</a><p>I wrote <a href="https://multi-launch.leftium.com" rel="nofollow">https://multi-launch.leftium.com</a>, which is only 6% JS. The majority is Svelte (65%) + TypeScript (27%). (<a href="https://github.com/Leftium/multi-launch">https://github.com/Leftium/multi-launch</a>)
Let's assume all the browsers did this. Developers still have to target older browsers, so they'd wait years before even starting to use the new language (unless maybe there could be a polyfill). So you're talking about a pretty large amount of work that simply wouldn't be used for years.
Dart was dead on arrival because it was controlled by one browser vendor and everybody else refused to support it.<p>If you wanted a non-JS alternative what would it be? Everybody has their own opinions, so… chaos.<p>Yes, there are giant frameworks all over the place for JavaScript and the browser environment is generally feared or loathed. That is not a technology failure. It’s a training failure. You can only fix a tiny bit of that with any alternative technology. Without proper training people will find a way to fear and abuse any alternative just the same.
The new language would have to be truly transformative and revolutionary to justify the switching costs. JS is pretty good and it gets better every year. I would love nothing more than a world with LISP in the browser and everywhere else but even if everyone agreed with me, the cost of getting there from here is far too great for even my unrealistic love for parentheses.
It's not a terrible idea but it's difficult to make it work.<p>First, they have to agree to work together.<p>Then they have to decide which language to implement and write a spec. It must also support what browsers do in JS (DOM manipulation, APIs, etc.)<p>Finally they have to implement it in an interoperable way.<p>All of that costs money and what is the advantage over JS to justify those costs?
Instead they fixed (mostly) everything that was initially wrong with JS (and now typescript).<p>Which is fine by me and seemingly every stakeholder out there.