What would be a good alternative to JavaScript for browsers?
JavaScriptprogramming-languagesfront-end
As a javascript/typescript dev of ~15 years I'm growing increasingly sceptic of the languages. It's definitely easy and flexible, but I find that there's an incredible amount of pitfalls that even senior developers run into. One thing I am certain about is that javascript has gone through a very large amount of changes in it's lifetime – it doesn't look at all like it did when it was released and its' intended usages have changed a lot. I can't help to think that there has to be a better way. Are we stuck with supporting mutable prototypes forever or what could an alternative look like? Personally I'd still want a scripting language, but one that would be a lot stricter. No binaries like wasm, less globals, preferably type safe. I'd also prefer if we could go a route that didn't rely on the event loop and supported multiple threads.
Synthesized Answer
Based on 1 community responses
A potential alternative to JavaScript could be a language that combines the benefits of functional programming with a strong focus on type safety and concurrency support. Languages like Rust and Haskell have shown that it's possible to create languages that are both performant and safe. For the web, a language that compiles to WebAssembly (WASM) could be a viable option, as it would allow for better performance and security. However, to avoid the pitfalls of WASM binaries, the language could be designed to be compiled to WASM in a way that's transparent to the developer. Another approach could be to extend or modify existing languages like TypeScript to better support concurrency and parallelism.
Key Takeaways
A language that combines functional programming with strong type safety and concurrency support
Compiling to WebAssembly for better performance and security
Designing a language that's compiled to WASM in a transparent way
Extending or modifying existing languages like TypeScript to support concurrency and parallelism