What's stopping WebAssembly from effectively replacing JavaScript? - eviltoast

I’ve been wondering about this for a while and haven’t really found a great answer for it. From what I understand, WASM is:

  • Faster than JavaScript

  • Has a smaller file size

  • Can be compiled to from pretty much any programming language

  • Can be used outside of the browser easier thanks to WASI

So why aren’t most websites starting to try replacing (most) JS with WASM now that it’s supported by every major browser? The most compelling argument I heard is that WASM can’t manipulate the DOM and a lot of people don’t want to deal with gluing JS code to it, but aside from that, is there something I’m missing?

  • Nighed@sffa.community
    link
    fedilink
    English
    arrow-up
    10
    ·
    1 year ago

    Unless it has improved since last time I used it then it’s awful to debug in the browser. I hate JavaScript, but would probably still use it for a new web project now.

    • AnarchoYeasty@beehaw.org
      link
      fedilink
      English
      arrow-up
      5
      arrow-down
      5
      ·
      1 year ago

      If you use rust and structure your program correctly you can avoid debugging directly by building unit tests in language the verify behavior. Debugging tools are great and I look forward to better dx stories there (you can use chrome + DWARF to debug your native code) but strictly speaking it isn’t necessary most of the time.

      • livingcoder@programming.dev
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        Can you please elaborate on how, when using Rust, we can avoid needing to debug our JS code? I am very interested and hope that I didn’t misunderstand you.