Code Will Eat Itself

Code Will Eat Itself

To prove the undecidability of the halting problem you have to feed a program its own source code as input. Sometimes this can be done by reading data from the filesystem, but Kleene’s recursion theorem guarantees that a program can always calculate its own source code without relying on external storage.

This talk shows how to extend any Ruby program with a local variable containing its own source.

A lightning talk given at Scottish Ruby Conference 2013 ( There’s a video of this talk at This talk is adapted from chapter 8 of Understanding Computation (


Tom Stuart

May 13, 2013