WebAssembly (WASM) is an open standard for an efficient and portable bytecode format for a stack-based virtual machine. One of the main goals for WASM is to provide a secure execution environment for untrusted code. Consequently, WASM code runs in a sandboxed environment that is separated from the host and is hardened against certain classes of memory safety bugs.
Programmers don't write WASM bytecode directly. WebAssembly code is generally written in a high-level, statically-typed language, that is then compiled into WASM bytecode. Languages that support WASM as a compilation target include C, C++, C# Go, Forth, Lisp, and others. Dynamic, interpreted languages like Python and JavaScript are also supported, typically by compiling the interpreter to WASM.
The features that make WebAssembly attractive for Wikifunctions are:
- WebAssembly code can execute on both client and sever;
- WebAssembly provides stronger isolation and security guarantees compared to executing native code in containers;
- WebAssembly is generally fast;
- WebAssembly gives us a way to support multiple languages with a single, common runtime.
The main disadvantage is that WebAssembly is still relatively new technology and the ecosystem is still maturing.
Let's investigate this!
Thanks to @Joe and @faidon for the suggestion.
Link dump:
- https://wasmer.io/
- https://blog.cloudflare.com/webassembly-on-cloudflare-workers/
- Python 3.11 will support WebAssembly as a build target; see this PyCon DE 2022 keynote.