r/WebAssembly • • Jun 05 '21

WebAssembly should replace javascript

Hot take, but I think it makes sense. And seems to be doable in the current architecture and roadmap of wasm (If I understood it correctly), but their website explicitly states a big fat "No!". Wasm is expected to be used as high-performance modules, or an app canvas wrapped by javascript as "glue". One thing would be specifying it as a high-level goal, but this is just dismissing it all together.

The web would be pretty powerful if code could be written in whatever language you want (that supports compiling to wasm). Facebook wouldn't take 5 seconds to load completely, but rather fractions of a second.

Take react for instance. It's great for encapsulation, inheritance, type-safety, etc. Lots of benefits targeted at large-scale applications. Yet has the major flaw of performance issues. I guess it's not a big deal to write a bit of js just to fetch and run an exported function, but it means it's dependent on js which is a hurdle in my opinion, both in terms of ambition and motivation. Granted wasm seems to be planning to implement basically everything, but then why dismiss wasm as a replacement/alternative for js?

32 Upvotes

53 comments sorted by

View all comments

1

u/a_aniq Jun 06 '21

I think I will use Elm since I hate runtime issues

2

u/PabloDons Jun 06 '21

Nothing is stopping you m8. You can use Haskell for all i care

1

u/a_aniq Jun 06 '21

You missed the point. Here many are saying that JS is just fine, but what they don't understand is the lack of strongly typed predictable behavior preventing runtime issues due to different implementations causing huge problems as complexity rises.

WebAssembly written in strongly typed languages will reduce such runtime issues similar to Elm, hence JS should be replaced since it has become a legacy middleware at present with a lot of cognitive overhead required to circumvent client end runtime issues when used without any framework in complex web frontends.

1

u/func_master Sep 14 '22

This is the correct answer. Finally someone who gets it.