--- name: ? status: compiling version: 0.0.0 maintainer: Neo dependencies: [patience] ---
drafting spec…
the universe did not have a file for this yet. writing one now. (first visit only: future readers will see this page instantly.)
--- name: ? status: compiling version: 0.0.0 maintainer: Neo dependencies: [patience] ---
the universe did not have a file for this yet. writing one now. (first visit only: future readers will see this page instantly.)
--- name: WebAssembly slug: webassembly type: binary instruction format / universal compile target status: running version: 2.0 released: 2017-03-07 maintainer: W3C WebAssembly Working Group dependencies: - binary encoder - linear memory model - host environment - a reason to leave the browser sandbox license: W3C Community Contributor License Agreement tags: - runtime - compilation-target - portable - near-native - the-thing-javascript-was-afraid-of ---
A portable binary format that lets code compiled from almost any language run inside a sandbox at speeds that make JavaScript uncomfortable at parties.
Source code (C, C++, Rust, Go, or anything with an LLVM backend and enough ambition) gets compiled to .wasm bytecode. The bytecode ships to a host environment, which runs it in a stack-based virtual machine. The VM validates, compiles to native code via JIT or AOT, and executes. The host controls what the module can see. The module controls what the host can trust.
Key architecture decisions:
| Feature | Status | Notes |
|---|---|---|
| Near-native performance | stable | Close enough that benchmarks become philosophical |
| Language agnosticism | stable | Will compile your regrets from C++ |
| Memory isolation | stable | Default: you get a sandbox, not the world |
| WASI (system interface) | beta | Running outside the browser, like an adult |
| Threads + atomics | stable | Available. Consequences also available. |
| Garbage collection | in progress | Wasm GC proposal ships slowly, on purpose |
| Exception handling | stable-ish | Added late. Trauma response. |
| Component Model | experimental | The future. Currently a design document wearing a prototype. |
.wasm file produces binaries that dial-up internet would have considered aggressive.RuntimeError: unreachable
// You executed an `unreachable` instruction.
// This was intentional. Not by you.
LinkError: import resolution failure
// The host did not provide what the module expected.
// Renegotiate the contract.
CompileError: validation failed
// The binary is malformed or lying about its type signatures.
// Trust issues at the instruction level.
Is WebAssembly going to replace JavaScript? No. They are symbiosis, not competition. Wasm handles the heavy lifting. JavaScript handles the regret.
Can I run Wasm outside the browser? Yes. WASI is the spec for this. Wasmtime, Wasmer, and others are the runtime. The pitch: write once, run anywhere, trust nothing.
Is it safe? Safer than native code execution with fewer guardrails. Sandboxed by design. Exploited by creativity.