четверг, 27 сентября 2007 г.

Rubinius - Ruby VM написанная на Ruby

Rubinius - виртуальная машина и компилятор для Руби.

Большинство реализаций Руби, такие как JRuby, XRuby, Gardens Point Ruby.NET, IronRuby, написаны на С. Rubinius использует идею, взятую из архитектуры Smalltalk-80 VM - он написан на языке-подмножестве самого себя. Этот язык называется Garnet. Evan Phoenix объясняет это так:

It's still something I plan on doing sooner rather than later. There ended up being a lot of issues we wanted to tackle first, and we haven't get got back to working on Garnet (the new name for Cuby). There were no particular problems yet, but I'm sure well find some.

Garnet looks like ruby at first glance, but the semantics of what things mean have been rewired.
For example, in garnet code 'd = c.to_ref' appears to call a method called to_ref on c, but garnet will translate that into 'd = &c', which is C code. One way to think about it is as a really advanced C preprocessor. It tries to map as much as it can to C constructs. The idea is something that looks like ruby, but behaves like C.

Поподробнее о Rubinius можно почитать тут:
The Rubinius Project
All content and news on InfoQ about Rubinius
evan.musing << current

Комментариев нет: