Notes on Writing WASM

WASM advice sparks Rust-only brawl: “Rust or bust,” say the comments

TLDR: A developer shared practical tips to make Rust-to-WebAssembly code less painful using wasm-bindgen. The comments erupted: critics called WASM bloated, niche, and Rust-only, while others debated whether the problem is WebAssembly itself or just its clunky tools—raising real questions about WASM’s future and accessibility.

A Rust developer dropped a practical guide to surviving WebAssembly (WASM)—the tech that lets fast, compiled code run in browsers and apps—by taming the Rust-to-JavaScript glue tool wasm-bindgen. The tips? Keep data lightweight across the border, avoid unnecessary copies, and give exported types clear names. It’s calm, pragmatic advice, with kudos to maintainers and a promise: there are patterns that make Rust + WASM much less painful.

But the comments? Full-on reality show. One reader bristled at the bait-and-switch: they wanted general “how to write WASM,” got “how to fight Rust tools.” Another torched WASM’s “mission creep,” saying it started as a way to speed up heavy math and now gets hyped as a universal plugin system—plus bloat. The spiciest take declared WASM a niche that “nobody uses,” predicting it’ll stay small forever.

Then the meta-drama: a cheeky comparison to PyO3 (Rust <-> Python bindings) being “nicer” than wasm-bindgen, sparking the question—is the pain WASM itself, or just the tooling? Meanwhile, a realist chimed in: today, WASM feels like a Rust club, and writing a WASI component (the system interface for WASM) needs a whole Rust toolbox. Cue the meme: “WebAssembly or WebAssumption?” Rust fans say the guide is useful; skeptics say it’s lipstick on a binary pig. Either way, the thread’s a popcorn buffet.

Key Points

  • The article provides practical patterns for using Rust with WebAssembly via wasm-bindgen to reduce interop friction.
  • wasm-bindgen generates glue code; some Rust types convert directly to JS (via IntoWasmAbi), others are exposed as opaque handles.
  • Recommended defaults: pass data by reference across the Wasm boundary and avoid &mut in favor of Rc<RefCell<T>> or Arc<Mutex<T>>.
  • Do not derive Copy on exported types; use wasm_refgen for types crossing the boundary within collections; adopt clear naming conventions (Wasm* for Rust exports, Js* for JS imports).
  • Manual bindings with js_sys are possible but can be brittle; relying on wasm-bindgen’s glue tends to yield better compile-time feedback.

Hottest takes

"I really hate wasm… because it gets bloated" — AyanamiKaine
"Why nobody uses wasm… it will remain a small niche" — shevy-java
"Wasm is basically a Rust thing… you need a bunch of Rust tooling" — Decabytes
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.