What if you could write software once and make it work on all phones and computers?
While this dream is still far from being realized, steps are underway to transform the web browser into a universal computing platform, capable of running even the most demanding applications.
The performance gains made possible by WebAssembly could one day see the heaviest desktop software run in the web browser. WebAssembly is already being used to run the traditionally very demanding AutoCad software as a proof of concept demonstration.
âMy dream is for every platform to become the web platform,â said Ashley Williams, systems engineer at Cloudflare and a member of the Rust core team at Qcon London 2019.
“I sincerely believe that the languages ââthat will be successful in the future will be the ones that can successfully target WebAssembly.”
How to get started with Web Assembly
WebAssembly (WASM) is not designed to be a programming language written by humans, although it can be viewed in a human readable format. Rather, it is a compiler-generated language, based on code written by developers in a higher-level programming language.
Williams says that while in theory it is possible to compile code written in any language in WASM, in reality you wouldn’t want to, the best options currently being compiled from C, C ++ programming languages. and Rust, rather than from an interpreted language.
“One thing to note about WebAssembly is that it doesn’t have a GC [garbage collector] and doesn’t have a runtime environment, you have to compile your runtime environment in addition to your program when using an interpreted language, âshe said.
Here are various tools developers can use to get started building and inspecting WebAssembly:
This is a backend for the LLVM compiler which generates WebAssembly from C, C ++, and Rust and which is used by the Unity and Unreal game engines to generate web versions of games.
If you want to experiment with WebAssembly but don’t feel like learning Rust, C, or C ++, there are compilers for higher-level languages.
âIn general, the WebAssembly that this produces isn’t necessarily the fastest or the smallest, but it works great and they are doing a lot of work on it right now,â says Williams.
WebAssembly.Studio is a fork of Visual Studio Code and runs in the browser, allowing developers to inspect WASM as it is compiled from C, C ++, and Rust.
The state of WebAssembly
SEE: Hiring Kit: Python Developer (Tech Pro Research)
However, WebAssembly is not a finished product, with plenty of room for improvement in both its support, functionality, and performance.
âWebAssembly is young, so what has landed in the browser right now is certainly not a fully mature product,â Williams says, giving the example of garbage collection that is not yet implemented in WASM.
âIf you’ve started working with WebAssembly now, you’ll immediately wonder, ‘Why is my WASM so big and why isn’t it as fast as I want it to be? “.
Williams is optimistic about the prospects for WebAssembly, and with many looking to the future of the web as it celebrates its 30th anniversary, she has high hopes for how WebAssembly could transform the platform.
“I think WebAssembly is going to lead to a future where the applications we are going to build are very different from what we see people doing now.”