Blame the compiler

Remember when you first started programming? Those early days when you’d take some code out of a book or article, type it out, and then try to make it print silly things or draw funny pictures?

The thing I remember about those days was the temptation to blame the compiler for all the ills of my code. Something doesn’t work right and you can’t figure out why? Blame the compiler! Of course, this was never right. The compiler is very rarely incorrect.

My goal today is to bring back the joy of blaming the compiler. Of course, Ruby doesn’t _have_ a compiler (yet!), so we have to play tricks. But that’s part of the fun!

Let’s blame the compiler.

See, all you have to do is extend BlameTheCompiler. And then you’ll find yourself with one chance in every three executions to say “Hmm, I’m sure I defined that method. Something must be wrong with Ruby.” Just like those early days of programming, you’re half right. The other half is that you’ve got a little prankster running in your application.

It’s a fun parlour trick. I would not, however, recommend sending code including BlameTheCompiler in as a bug report to the JRuby or Rubinius folks. They wouldn’t find it as funny as you or I.