From: Mikael Brockman Date: 2004-05-13T09:32:41+09:00 Subject: Re: Rite Implementation Idea Ryan Paul writes: > I just finished reading about Rite (thx to Mark for bringing it to my > attention, btw!), and I was wondering if there have been any significant > recent developments, or if there is a place where such developments are > chronicled. If ruby is in need of a new virtual machine, why not base it > on OCaml? OCaml's VM is very quick indeed. But it's quick for OCaml code, and OCaml code is very different from Ruby code. Actually, I'd say they're almost opposites. Ruby's extremely dynamic, and OCaml's extremely static. Ruby lets you reify the current continuation. ocaml has no support for that, so you'd have to either (1) rewrite the Ruby code in continuation-passing style, (2) ditch the ocaml stack and put everything on the garbage-collected heap, or (3) hack the C code to copy the stack. And so on. In my infinite wisdom, I predict that implementing Ruby atop the OCaml VM would be very close to implementing a new Ruby VM atop the OCaml VM. Besides, most of the magic is in the compiler, anyways. The OCaml VM is pretty straight-forward, I seem to recall. But the compiler, oh yeah! OCaml is much easier to optimize than Ruby, but ocamlc is still really impressive. And compared to the byte-code compiler, virtual machines are easy to write. If you haven't done so, matz, you should probably take a look at the design of OCaml's VM; there are probably good ideas to be stolen. But I doubt it'd be good to actually _use_ it. Of course, I'm probably missing something, or plain out wrong.