by spprashant on 1/9/24, 10:19 PM with 19 comments
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.
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.
Obviously right off the bat I can think of dozen issues with this suggestion.
- 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.
I am just looking for someone to explain to me at a high-level why this is a terrible idea. Thanks!
by solardev on 1/10/24, 12:50 AM
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.
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.
by ativzzz on 1/10/24, 3:55 PM
by Leftium on 1/10/24, 5:38 PM
Also, many other languages compile to JS (without WASM). Notably:
- https://www.typescriptlang.org/
I wrote https://multi-launch.leftium.com, which is only 6% JS. The majority is Svelte (65%) + TypeScript (27%). (https://github.com/Leftium/multi-launch)
by wmf on 1/9/24, 11:02 PM
by austin-cheney on 1/10/24, 10:44 AM
If you wanted a non-JS alternative what would it be? Everybody has their own opinions, so… chaos.
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.
by thot_experiment on 1/9/24, 10:37 PM
by pmontra on 1/9/24, 10:28 PM
First, they have to agree to work together.
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.)
Finally they have to implement it in an interoperable way.
All of that costs money and what is the advantage over JS to justify those costs?
by revskill on 1/10/24, 5:42 PM
by aristofun on 1/10/24, 3:47 AM
Which is fine by me and seemingly every stakeholder out there.
by uberman on 1/9/24, 10:35 PM
by fsagx on 1/10/24, 12:32 AM