Saturday, March 1, 2008

MacRuby

MacRuby sounds very cool (via Jens Alfke):

In MacRuby, all Ruby classes and objects are actually Objective-C classes and objects. There is no need to create costly proxies, convert objects and cache instances. A Ruby object can be toll-free casted at the C level as an Objective-C object, and the Ruby VM can also handle Objective-C objects without conversion.

I hope this can be done for Python, too.

3 Comments RSS · Twitter

I think it doesn't make much sense for Python. Python's object model is derived from C++, where the Objective-C object model is derived from SmallTalk.

Because Ruby's object model is also derived from SmallTalk, you don't have the rather fundamental impedance mismatches that you would get with Python, such as multiple inheritance vs. categories/open classes.

I don't think the differences are that large. Python does let you add methods to existing classes; it just isn't commonly done. It supports multiple inheritance, but you can get by fine without it, and with the appropriate runtime magic this could probably be added on top of NSObject, if necessary.

Yeah it is odd for it to seem to prominent. Alongside macports even. However, I believe half the goal of macruby was to attempt to overcome speed issues for RubyCocoa, which...speed issues aren't so much of a problem for python.

Leave a Comment