• Ephera@lemmy.ml
    link
    fedilink
    arrow-up
    3
    ·
    10 months ago

    Sure, but you can get frameworks that generate that for you. I’ve written whole webpages in WASM without writing any JS.

    You don’t get around reading JS documentation, though. Especially the DOM API is just documented as JS, and you basically hope that your framework makes it obvious enough how to write that in your non-JS language of choice.

    • Static_Rocket@lemmy.world
      link
      fedilink
      English
      arrow-up
      5
      ·
      10 months ago

      This is exactly the reason why I can’t believe that was ever a requirement. I would have crazy respect for webassembly if it could stand on it’s own as it would allow people to completely move away from JS, but if JS is still in the stack in any way it will introduce a (even if it is minimal) compatibility and maintenance cost in the long run.

      • Ephera@lemmy.ml
        link
        fedilink
        arrow-up
        3
        ·
        10 months ago

        I used to think so, too, but on the one hand, the DOM API is absolutely massive. Going through the standardization, implementation and documentation process another time would take decades.

        And on the other hand, a language-agnostic API in WebAssembly would mean specifying it WebAssembly itself. And well, it’s Assembly-like, so what’s currently a single line for calling a JS function would turn into tens of lines of low-level code.

        Ultimately, you’d want code from some other high-level language to give you a summary of how you may need to call your language-specific wrapper. In practice, that’s likely even worse than translating it from JS, because the high-level call isn’t standardized.