Evan Phoenix talked with InfoQ to discuss Rubinius, a modern Ruby VM loosely based on the Smalltalk-80 architecture. Rubinius's goal is to be a fast, efficient Ruby VM utilising the latest research in dynamic language implementations.
Evan discusses the history of Rubinius, particularly its Smalltalk roots:
“[Rubinius] uses the same architecture decisions as the first Smalltalk VMs … basically make everything first class, keep the internals of it very small and provide a very small number of primitive operations and build everything on top of it“
However, he talks about how it wasn’t easy gather and apply the knowledge contained within the various implementations of Smalltalk currently available:
“Unfortunately, it is hard to find the source for a lot of Smalltalk VMs. [For example,] the Strongtalk source is very hard to get into so I have used it not so much for taking code out of there but rather using it for ideas about how they solved some problems.“
One of the major advantages of Rubinius is that it is a Ruby implementation written in as much Ruby as possible. This makes the internals of the language far more accessible to the users of the language. For example, Rubinius contains Ruby implementations of much of the Ruby standard library which in MRI, Matz’s Ruby Interpreter, the standard Ruby implementation, are currently implemented in C . However, not all of Rubinius is written in Ruby. There is a small core of the VM which is currently written in C, but there are plans to have this code generated by a more Ruby-like language:
“The eventual goal is to reduce the amount of C code that we have hand written and start to generate more C code“
The Rubinius team is already using a number of code-generation techniques to achieve this:
“We already do some kind of C meta-programming ... which allows us to keep [the code] organized and also to do some pre-processing on the actual code before it gets compiled. A lot more pre processing that you can do with CPP and normal C pre-processor.“
The Rubinius project was one of the first projects to popularise the use of Git the distributed version control system used by the Linux kernel development team. One of the major advantages of Git over more mainstream version control systems such as Subversion is the ease of creating and merging branches. Evan was very keen usefulness of this feature for the development of Rubinius:
“I personally have become fairly addicted to using local branches. I have 8 or so branches at a time usually for small fixes, for experiments, [and] for things I am working on.“
Evan also talks about Rubinius’s very fast debugging support, its profiler, upcoming support for object-persistence layers and the planned support for Smalltalk-like image-based persistence:
“You could engineer your application so you could start it up, let it get to a certain point and then save it out to disk. And the next time you unserialize it, you just continue where you saved it out to disk“
Evan explained the Rubinius project’s novel approach repository access control:
“There are a lot of casual programmers out there, weekend patchers if you will, and you want to really try and harness their enthusiasm … I have this policy where after you get your first patch committed you get commit rights … instilling that trust to developers has really proven that they stick around longer, they are more likely to send in patches and more likely to contribute to the project as a whole.“
When asked whether he would like the Rubinius VM to support languages other than Ruby, Evan was very enthusiastic about the idea:
“I would love to. In fact I have been talking with Ola Bini a few times about the ability of developing a simple Lisp that would run on top of the Rubinius VM.“