ezyang’s blog

the arc of software bends towards understanding

February, 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

Ad hoc approximations

In his book Against Method, Paul Feyerabend writes the following provocative passage about ‘ad hoc approximations’, familiar to anyone whose taken a physics course and thought, “Now where did they get that approximation from...” The perihelion of Mercury moves along at a rate of about 5600" per century. Of this value, 5026" are geometric, having […]

  • February 23, 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

Two short tips for FFI bindings

To: Oliver Charles Subject: [Haskell-cafe] Please review my Xapian foreign function interface Thanks Oliver! I haven't had time to look at your bindings very closely, but I do have a few initial things to think about: You're writing your imports by hand. Several other projects used to do this, and it's a pain in the […]

  • February 20, 2011

On checked exceptions and proof obligations

Checked exceptions are a much vilified feature of Java, despite theoretical reasons why it should be a really good idea. The tension is between these two lines of reasoning: Well-written programs handle all possible edge-cases, working around them when possible and gracefully dying if not. It's hard to keep track of all possible exceptions, so […]

  • February 18, 2011

Picturing Hoopl transfer/rewrite functions

Hoopl is a “higher order optimization library.” Why is it called “higher order?” Because all a user of Hoopl needs to do is write the various bits and pieces of an optimization, and Hoopl will glue it all together, the same way someone using a fold only needs to write the action of the function […]

  • February 16, 2011

Picturing binomial coefficient identities

Guys, I have a secret to admit: I’m terrified of binomials. When I was in high school, I had a traumatic experience with Donald Knuth’s The Art of Computer Programming: yeah, that book that everyone recommends but no one has actually read. (That’s not actually true, but that subject is the topic for another blog […]

  • February 14, 2011

Android 2.x Sensor Simulator

OpenIntents has a nifty application called SensorSimulator which allows you feed an Android application accelerometer, orientation and temperature sensor data. Unfortunately, it doesn't work well on the newer Android 2.x series of devices. In particular: The mocked API presented to the user is different from the true API. This is due in part to the […]

  • February 11, 2011

A suggestion for indent/php.vim

To: John Wellesz First off, I'd like to thank you for authoring the php.vim indentation plugin. Recent experiences with some other indentation plugins made me realize how annoying editing can be without a good indentation plugin, and php.vim mostly has served me well over the years. However, I do have a suggestion for the default […]

  • February 9, 2011