just dans

Making programming (everything) more accessible

13 Jul 2020

A single C file

A single C file

Alon Zakai’s WebAssembly and the Elusive Universal Binary talk has me really excited. If your whole program compiles to a single C file, you’ve got a fighting chance of making changes to it and being able to understand those changes, especially if the runtime is in that C file. I’ll have to look at the output!

The talk promises that the resulting binary makes the same security guarantees as a wasm interpreter would: you have to grant the program permission to touch anything on the filesystem. If that’s the case, then you can shrink the containers needed to run programs considerably (and eventually not use containers at all, just cgroups).

What I’m eventually after is not having to say “I wish I’d logged that,” not having to wonder why your program is doing what it’s doing. To do that I think we’ll want to peel away most everything that changes about a program over time: resource consumption, mutated state. Make programs run for very short periods of time and append to a persistent data structure. I keep coming back to WebAssembly because it’s so small, it doesn’t have a lot of stuff in it yet, like garbage collection. Compiling to a single C file using WebAssembly (or subsets of it) locks in that simplicity. If interpreters continue to add features, that’s fine, we can still our dirt-simple binaries.