Ruby + ObjC = MacRuby
March 11, 2008 by Philippe Mougin
Laurent Sansonetti, Apple's Ruby wizard, has released MacRuby, an Apple open source project which unifies Ruby and Cocoa (instead of just bridging them like RubyCocoa does).
MacRuby is a version of Ruby that runs on top of Objective-C. More precisely, MacRuby is currently a port of the Ruby 1.9 implementation for the Objective-C runtime and garbage collector.
Laurent talks about the innards of MacRuby in this interview at InfoQ:
The Ruby object data structure had to be modified to conform to the Objective-C object data structure, so that a Ruby object can be casted at the C level as an Objective-C object. Then, the object allocator was modified to use the Objective-C one instead, which means that all objects (Ruby and Objective-C) are allocated from the same memory pool.
Finally, the traditional Ruby garbage collector was removed and instead we use the Objective-C garbage collector. This change wasn't very easy because the collector runs by default in generational mode, and expects you to appropriately set “write-barriers” every time you register an object in the object store, because it collects young generation of objects based on this information. [Read more here]