WebAssembly (shortened to WASM) is supported by all major browsers. It is a binary file that runs on the web. The latter sentence is a huge understatement and disguises the true value and innovational strides made by WebAssembly.

The base of the web is built on the following; structure (html), style (css), logic (Javascript). HTML, CSS and Javascript were introduced to the web within 3 years of its existence and since then we haven’t added anything else. Until now.

WebAssembly gives us the ability to write our logic in languages other than Javascript such as C, Rust, and Go. There is nothing wrong with Javascript but there is something wrong with only having one opinionated choice to write logic in.

Beyond just being able to write code for the web in languages other than Javascript WebAssembly also comes with a few other benefits. Its super small, it’s extremely fast and once it’s cached by the browser reloading that module is almost instantaneous.

But if we are able to write web code in Rust and C does that not open up some security concerns? Will I now have to worry about WebAssembly poking around in my file system? No. WebAssembly still runs in the browsers secure sandbox. So far we have trusted browsers with this responsibility. This is another benefit of WebAssembly. Lightweight sandboxing.

Wow this sounds like an awesome security benefit. Isn’t this something we need in our other apps. (foreshadowing much)

What I see as the most important aspect of what WebAssembly brings to the table has nothing to do with the Web. Languages such as C, Rust, C++, Pascal don’t require a runtime. They are compiled languages. They are compiled to a single binary file that can just be run. However, if you want to run it on Linux instead of Mac the binary have to be compiled twice, once for Mac and a second time for Linux. If you want to support all the popular systems out there you end up with a binary for each system architecture and a sizeable hole in your disk space.

With WebAssembly you just need one binary to rule them all.

Enter WASI. WASI is WebAssembly’s modular system interface. Simply put it’s a specification. Any system that implements WASI will be able to run WebAssembly.

This is starting to sound like JVM right? In a way they are similar. This biggest difference is that JVM was designed to support Java and we all know how awesome java is (not awesome, not at all). Whereas WASI is a specification and has already been implemented in runtimes such as Wasmtime and node, javascript, Python and many others. That’s true portability.

Screenshot 2020-04-01 at 16.59.23

One of the most exciting aspects of this is not only will we be able run native apps anywhere with native level performance (picture Photoshop running in the web) but we will be able to run all those with a lightweight secure sandbox. This is great news for security, we no longer have to trust the application developer not to delete all your files or set your browser homepage to Yahoo.

WebAssembly has a seriously bright future. We are currently only scratching the surface. I suggest you jump on this train as it certainly doesn’t feel like fad that will go away anytime soon.