I never actually wanted to be a VM guy.

I fell in love with Smalltalk because it was simple and powerful and it fit the way I thought. (Later I fell in love with Self because it was even more so. ;)) The languages that I like best are the ones that are designed for human beings (rather than for computers or drones or mathematicians).

But every so often I have a language idea I’d like to try out – and to do that, it helps to be able to tinker with VMs. Unfortunately, VMs these days tend to be written in languages like C – and thanks to all the cool optimization technologies needed to make a language like Self run fast, they tend to be fairly hefty chunks of C, too. The Self VM is over 100,000 lines of C++, and I’m kinda scared of it.

So I dream of having a VM that’s simple and malleable and debuggable and written in a high-level language, but also includes enough Self-style optimization technology that it can make a really pure OO language run well. That’s one of the reasons why I was so excited about Klein – one of our goals was to produce a VM like that, written almost entirely in full object-oriented Self, and a VM-development environment that’s as comfortable and interactive as a regular Self or Smalltalk application-development environment. (So far, it seems to me like the “fully OO” part has been working out pretty well, but the interactiveness part has proven to be a major challenge – the project is still plagued by long compile times. I think it’s solvable, though.)

There hasn’t been any serious work done on Klein since Sun cancelled the project back in late 2005, but I pulled out the code a few months ago and started spending my spare time working on it. There’s nothing in there really worth seeing yet – I’m still working out the bugs in the inlining compiler that I just wrote, so everything’s kinda broken right now. (I’m hoping to have the inlining compiler working dynamically soon, though, at which point it’ll be interesting to see how much of a difference it makes, since practically everything in Klein, right down to the innermost loops of the GC, is written in an OO style with lots of message sends.) But one of the reasons I’m writing this post is because I’m wondering whether there’s anybody out there who feels like doing some hacking on Klein – there’s lots of fun stuff to be done, and I’d welcome the help.

I’m also wondering whether there’s another VM out there that’s further along towards fulfilling Klein’s goals. (I haven’t been keeping up with the VM world over the past few years.) Maybe Exupery?

And my third wondering is whether there’d be interest in Klein outside the Self community. If Klein ever does become a usable Self VM, it ought to be usable for other OO languages too, especially Smalltalk. If there was interest in the Smalltalk community in having a Klein-style VM, I’d make it a higher priority to teach Klein to handle non-LIFO blocks, which was one of the main obstacles preventing Mario Wolczko’s Smalltalk-to-Self translator from being a production-ready Smalltalk. (Sometimes I think about doing that for the current Self VM, just because I envy the size of the Smalltalk community – it’d be nice to be able to use Smalltalk libraries inside Self. Plus it might be kinda fun to work in a system with Smalltalk objects and Self objects living side-by-side – though the purist in me thinks it’d be a shame to complexify Self with all those unnecessary “class” things. 😉 But that’s a topic for another blog post.)

Anyway, that’s what’s going on with Klein these days. I’m not sure whether it’s worth pursuing or not. Working on the GC and the inlining compiler has been kinda fun (turns out that being a VM guy isn’t so bad after all), but I’m more likely to keep going with it if I know that people are actually interested in it.