Skip to main content

A Mere Mortal’s Guide to Webassembly

Let’s learn some WebAssembly. This guide is intended if you plan on getting nice and intimate with WebAssembly, whether that means writing a back-end for a compiler, hand writing WASM or inspecting the output of an existing compiler. It’s not really that useful if you’re just using Rust/C/whatever compiled to WebAssembly. I wrote this guide because I’ve spent a lot of time trying to understand the WebAssembly specification for my own projects.

git commit -m Considered Harmful

Stop using -m in git. It encourages short, lazy commit messages. It makes it harder to figure out when changes occur. And yes, at some point you will need to track down when someone refactored the parser and introduced a buffer overflow bug. If I had to guess why people use -m, it’s because git commit by default dumps you into vim. If you don’t use vim, this is a very unpleasant experience (cue the five million memes on quitting vim).

Those Damn Squares

I’m not one for productivity metrics. I’ve tried apps like ActivityWatch and they don’t do it for me. Goodhart’s Law comes to mind: When a measure becomes a target, it ceases to be a good measure. However there is one metric I occasionally use: GitHub squares. I’m referring to those squares that can either be filled in with varying shades of green—indicating you’ve contributed a certain amount of times this day—or left gray, as an indicator that you have not contributed this day.

Don’t Focus On The Mountain; Focus On The Path

This story starts with structs. I had been making some progress with my programming language, Saber. I had implemented functions, control flow, local variables, basically enough to get a factoral function written. However Saber needed more than just the basics. I wanted structs, strings, all the nice complicated types that we take for granted. For that I needed dynamic allocation. For that I needed an allocator. But wait, I actually need a garbage collector.

Learn to Cook

Do yourself a favor. Learn to cook. Not only is it easy, rewarding, fun, intellectually stimulating, attractive, yadda yadda, it’s a pretty essential part of one’s existence. Every human needs to consume food to survive. It might be good to know how to make food. You don’t have to cook often, although practice will make you better. Yes, yes, I know you’re too busy creating a company/raising a child/writing a novel to cook.

Saber Notes: Strings

I’ve been working on my language, Saber a lot recently. I figured I should keep some notes on implementation in case someone finds them useful, even if that’s only future-me. Saber is a scripting language intended to be a lightweight row-polymorphic psuedo-functional language that compiles to WebAssembly. Think OCaml meets the best parts of ES6. Of course right now I’m just trying to get basic functionality finished. The compiler is written in Rust.

Saber Notes Factorial

I’ve been working on my language, Saber a lot recently. I figured I should keep some notes on implementation in case someone finds them useful, even if that’s only future-me. Saber is a scripting language intended to be a lightweight row-polymorphic psuedo-functional language that compiles to WebAssembly. Think OCaml meets the best parts of ES6. Of course right now I’m just trying to get basic functionality finished. The compiler is written in Rust.

Saber Notes: Name Table, Parameters & Local Variables

I’ve been working on my language, Saber a lot recently. I figured I should keep some notes on implementation in case someone finds them useful, even if that’s only future-me. Saber is a scripting language intended to be a lightweight row-polymorphic psuedo-functional language that compiles to WebAssembly. Think OCaml meets the best parts of ES6. Of course right now I’m just trying to get basic functionality finished. The compiler is written in Rust.

We Get It

Spend enough time procrastinating on reddit, you inevitable end up reading the same links again and again and again. One of the common links I see are the ones that complain about JavaScript. There’s wat, the tried and tired ecosystem article and many many more. To all of those articles, I just want to say: We get it We get it, JavaScript sucks. It’s insecure, it has weird features, npm is out of control, etc.

Apple & Fashion

Go online and you’ll find particularly potent venom directed towards Apple. Critics denigrate their products as overpriced, underpowered1 scams that only uninformed dolts would buy. Others insist that Apple has become unduly obsessed with aesthetics. They perpetually raise the question: Do people really want thinner phones? Do people really need a lighter laptop? To answer these questions, yes. People do want a thinner phone. They do want a lighter laptop. Why?