Rubinius Is Fun!

Wow. I’ve been busy. More busy that I’ve ever been!

No blogging, no coding, no sleeping kind of busy! :-)

But, I’ve taken a little bit of time to work on Rubinius after spending a couple of days with Evan at RailsConf Berlin.

Want to know a secret? Working on Rubinius is really, really fun.

I had noticed that a YARV benchmark was failing when run under Rubinius. It turns out that Class#attr had never been implemented. That’s not surprising, as the Rubinius crew works on whatever they need at the moment, in true agile fashion.

So, I checked out the code using git (hang in there, it gets easier once you’ve used it a bit!), got Rubinius built on my trusty MacBook, and fired up TextMate.

I probably spent about 8-10 hours implementing the patch. In the end, I ended up refactoring the entire attr_* family to DRY them up a bit.

One of the coolest things about Rubinius is that I implemented all this in Ruby. Yes, I wrote part of the Rubinius implementation in Ruby! How cool is that? I think it’s really cool because I simply don’t have the C chops (anymore!) to even begin to help if C was required.

The next cool thing was learning a tiny bit about spec based testing. You see, since the Rubinius project has rather significant spec coverage, I absolutely knew when I was done and ready to commit, because the spec tests were passing, where they didn’t before. This made it really easy to get started!

So, I’m really quite jazzed about this! Why? Well, for a couple of reasons:

1) Rubinius is progressing! A really good Ruby implementation draws near, and I helped, albeit in a very small way. Rubinius is very much a building block sort of project, however, so my work will help others out. In fact, I already talked to someone in the #rubinius IRC channel ( that had taken a few stabs at attr, because he needed it working to work on what he wanted to work on.

2) Someday soon, this little bit of code has a good chance of skyrocketing to the top of my “most used code” list. Think about how many uses of attr, attrreader, attrwriter and attr_accessor will use this code in the future! :-)

So, I’m off to bed. It’s late, but I’m happy. For the first time in quite a while, I feel like a bit of a hacker again!