My time with Rust and WASM

Jarrod Overson
3 min readNov 2, 2020

--

A few weeks ago I decided to take PTO to focus on understanding the current state of Rust and Web Assembly (WASM), two promising technologies that look completely unrelated. Rust is a language designed for systems programming, WASM is a bytecode standard designed for web browsers to be an alternative runtime to JavaScript.

On the surface, WASM looks immature, niche, and barely usable. You can’t even send text strings between a WASM guest and host, only numbers. Below that surface is a community on fire. Teams are sprinting at breakneck speeds to create runtimes, host environments, cloud solutions, system bindings, and everything in between. It’s not just one more new technology surrounded by a bunch of excitable nerds. These projects are taking first stabs at drawing a line around the smallest and most portable bundle of logic. As soon as the dust settles, how we write and run software will fundamentally change.

Hold up. Why Rust, though?

I’ve spent a lot of time writing, parsing, and analyzing dynamic languages like ruby, perl, and JavaScript. They are hard to test, hard to maintain, and hard to predict. I’ve also spent a lot of time with languages like C++ and Java. C++ is valuable for speed and control but not for the developer experience or the security. The JVM’s garbage collector makes performance unpredictable across different environments. Rust is obnoxiously safe, aggressively typed, and GC-free. The developer experience is not great but the developer experience will be much less relevant in the future.

Yes, the developer experience will become largely irrelevant. Well, that’s not true, but we’ll tolerate a lot more pain than we do now. WASM will change how we write applications and shift the cost/value ratio we are used to with code. Code is not valuable. Why? It’s difficult to reuse. If you’re a developer you probably groaned at that. If you’re an executive, product manager, or literally anyone else who works with programmers, I’m sure you are screaming in your head: “YES! Why?? Why do programmers have to rewrite everything all the time and why does it take two weeks to add a button to the checkout flow???”

Code is difficult to reuse.

If code isn’t reusable then each line of it isn’t worth much. When things aren’t valuable they need to be cheap. Code is cheap if developers can churn it out fast. Conversely, if you can reuse code across server, browser, iOS, Android, wearables, embedded devices, pacemakers, HVAC units — anything — it becomes much more valuable. With high value we accept high cost. The priority will shift from ease of creation and maintenance to performance and security above all. Rust wins in both categories right now.

I started this experiment saying “if both Rust and WASM aren’t the future of all computing, then whatever is will look similar.” I’m sticking with that statement.

--

--

Jarrod Overson

I write about JavaScript, Rust, WebAssembly, Security. Also a speaker, O'Reilly Author, creator of Plato, CTO @Candle