ezyang’s blog

the arc of software bends towards understanding

Software Engineering

Rage bug reporting

At Facebook, we have an internal convention for tooling called "rage". When something goes wrong and you want to report a bug, the tool developer will typically ask you to give them a rage. For a command line tool, this can be done by running a rage subcommand, which will ask about which previous CLI […]

  • April 25, 2021

Online/offline continuous integration

Raise your hand if you've ever put one of these commands in your continuous integration scripts: apt install somepackage pip install -r requirements.txt or pip install somepkg conda install blah cabal update or cabal install blah git clone https://github.com/someguy/somerepo wget http://some-website/thingy-latest.tgz Can you tell what the problem is? These commands are not reproducible: depending on […]

  • March 12, 2018

Seize the Means of Production (of APIs)

There's a shitty API and it's ruining your day. What do you do? Maybe you're Dropbox: Apple's privileges API isn't giving you the knobs you need, so you're like, "Fuck this, we're going to edit the privileges SQL database directly." Maybe you're Adam Belay: POSIX isn't letting you write high performance networking code, so you're […]

  • September 13, 2016

The fundamental problem of programming language package management

Why are there so many goddamn package managers? They sprawl across both operating systems (apt, yum, pacman, Homebrew) as well as for programming languages (Bundler, Cabal, Composer, CPAN, CRAN, CTAN, EasyInstall, Go Get, Maven, npm, NuGet, OPAM, PEAR, pip, RubyGems, etc etc etc). "It is a truth universally acknowledged that a programming language must be […]

  • August 21, 2014

Plan 9 mounts and dependency injection

“Everything is a file.” [1] This was the design philosophy taken to its logical extreme in Plan 9. Any interface you could imagine was represented as a file. Network port, pixel buffers, kernel interfaces—all were unified under a common API: the file operations (open, read, write...) Plan 9 used this to eliminate most of its […]

  • November 8, 2012

Killer mutants attack (mutation gone wrong)

This is a collection of WTFs due to misuse of mutable state. We'll start off with some Java. What do you expect this snippet of code to do? Sensor Accel = sm.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); Sensor Orient = sm.getDefaultSensor(Sensor.TYPE_ORIENTATION); sm.registerListener((SensorEventListener) this, Accel, sm.SENSOR_DELAY_FASTEST); Ostensibly, it registers the current object to receive just accelerometer updates. But what if I […]

  • March 9, 2011

On cargo culting and hacking

two inflammatory vignettes The term to cargo cult is one with derogatory connotations: it indicates the act of imitating the superficial exterior without actually understanding the underlying causal structure of the situation. The implication is that one should try to understand what one is doing, before doing it. There is, however, an ounce of truth […]

  • February 28, 2011

Multi-day debugging

Most of my hacking cycles right now are going towards debugging the new code generator for GHC. The code generation stage of GHC takes the Spineless Tagless G-machine (STG) intermediate representation (IR) to the C-- high-level assembly representation; the old code generator essentially performed this step in one big bang. The new code generator is […]

  • February 25, 2011

Semi-automatic testing

When programmers automate something, we often want to go whole-hog and automate everything. But it’s good to remember there’s still a place for manual testing with machine assistance: instead of expending exponential effort to automate everything, automate the easy bits and hard-code answers to the hard research problems. When I was compiling the following graph […]

  • February 21, 2011