Comment by hoppp

2 months ago

Lucky you. I keep coming back to it because jobs and even for desktop apps a native webview beats everything else.

We fcked up with js, big time and its with us forever now

I was hyped for wasm because i thought it was supposed to solve this problem, allowing any programming language to be compiled to run in browsers.

But apparently they only made it do like 95% of what JS does so you can't actually replace js with it. To me it seems like a huge blunder. I don't give a crap about making niche applications a bit faster, but freeing the web from the curse of JS would be absolutely huge. And they basically did it except not quite. It's so strange to me, why not just go the extra 5%?

  • That 5% of js glue code necessary right now is just monumentally difficult to get rid of, it's like a binary serialization / interface (ABI) of all DOM/BOM APIs and these APIs are huge, dynamic, callback-heavy and object-oriented. It's much easier to have that glue compiler generated, which you can already do right now (you can write your entire web app in rust if you want):

    https://github.com/wasm-bindgen/wasm-bindgen https://docs.rs/web-sys/latest/web_sys/

    This is also being worked on, in the future this 5% glue might eventually entirely disappear:

    > Designed with the "Web IDL bindings" proposal in mind. Eventually, there won't be any JavaScript shims between Rust-generated wasm functions and native DOM methods

  • Maybe its something about sharing memory with the js that would introduce serious vulnerabilities so they can't let wasm code have access to everything.

    The only way to remove Js is to create a new browser that doesn't use it. Fragments the web, yes and probably nobody will use it

  • The DOM is fundamentally dependent upon JS shaped data structures and garbage collection. They are BFFs.

    Any attempt to bypass this will be perilous.

A webview doesn't beat anything for desktop apps. It is the worst option available.

  • A go desktop app with native webview: 3.3 MB starting size

    A go desktop app rendered with OpenGL: 39MB starting size

    So its smaller than Gpu rendered desktop app and I get to use CSS for styling which is very powerful