Hacker News new | ask | show | jobs
by machuidel 3758 days ago
Since I started hearing about WebAssembly I cannot stop thinking about the possibilities. For example: NPM compiling C-dependencies together with ECMAScript/JavaScript into a single WebAssembly package that can then run inside the browser.

For people thinking this will close the web even more because the source will not be "human"readable. Remember that JavaScript gets minified and compiled into (using Emscripten) as well. The benefits I see compared to what we have now:

- Better sharing of code between different applications (desktop, mobile apps, server, web etc.)

- People can finally choose their own favorite language for web-development.

- Closer to the way it will be executed which will improve performance.

- Code compiled from different languages can work / link together.

Then for the UI part there are those common languages / vocabularies we can use to communicate with us humans: HTML, SVG, CSS etc.

I only hope this will improve the "running same code on client or server to render user-interface" situation as well.

2 comments

More importantly, if we want to make "view source" more palatable in a WebAssembly age, we need to have it support source maps from day 1.
Yes, that would be good for development / debugging (like debug symbols) or as an optional way to give people access to the source.
>For example: NPM compiling C-dependencies together with ECMAScript/JavaScript into a single WebAssembly package that can then run inside the browser.

The reason you'd write stuff in C is (aside from performance) to access native API. Browsers and WASM doesn't let you do that.

WASM in the Node could let you do that - meaning that you would get cross platform assembly packages instead of ELF or w/e binary - but you would still need APIs on the platform and often for C the way that's handled is preprocesor macros that choses which platform you are compiling to - so you can't just "compile to WASM and then magic" even with WASM you'd have to "compile to WASM + POSIX and WASM + Win32" if you want to run on POSIX/Win32, etc. for all platform/API permutations.

TL;DR WASM is big but it won't quite be the abstract virtual machine like say JVM or CLR