[MacRuby-devel] next release

Laurent Sansonetti lsansonetti at apple.com
Thu Mar 13 15:52:08 PDT 2008


Hi,

For the next release, my objective is to re-implement String, Array  
and Hash using CoreFoundation. The idea is to have only one  
implementation for every primitive class, and therefore be able to  
pass primitive objects from Ruby to Objective-C without having to pay  
any cost.

Basically, String would disappear as a class, and would be an alias to  
NSString. The whole String interface would be re-implemented on top of  
NSString, using the CFString API. The same goes for Array and Hash.

There are several problems that need to be investigated, such as the  
new 1.9 i18n strings that can have different encodings, or the fact  
that Cocoa collections do not accept nil as an element. The new  
implementation should be as realistic as possible.

However I doubt we can keep the C API compatible. At least  
RSTRING_PTR / RARRAY_PTR will not accept inline array modifications.

I will start with Hash first because it's the most simple one.

This change will also be interesting performance-wise. We might see  
some surprises when benchmarking against the original implementation.  
I suspect the new Array will be faster.

Laurent


More information about the MacRuby-devel mailing list