Member-only story
The Importance of Writing WASM-Compatible Code
It doesn’t take much effort, and it might be the key to distributing it
I’ve already written a couple of articles about WebAssembly and Rust, but this post should be useful for everyone that is writing code in a language that can compile to WASM, especially if you are using first-class WebAssembly citizens like Rust, C, C++, or Zig.
If you’ve not read WASM-introductory resources like this post, WebAssembly is a binary language converted into machine code by its VM. You heard right, it’s VM, meaning that you only need a VM that supports WASM to run any executable ending with .wasm
. Additionally, compiling your code to WASM requires minimal effort in most cases.
The Workflow of a WASM Application
Before getting into why you should have a wasm-compatible version of your code, let’s take a look at what your process of developing and deploying a WASM app could look like:
- write code/port existing code into a wasm-compatible fork
- compile it to WebAssembly
- publish the
.wasm
binary - have people running it, for example:
wasmer run your_code.wasm