Satoshi Nakagawa
snaka****@infot*****
Sun Sep 2 15:51:26 JST 2007
Hi Eloy. > I see that you've ported quite some methods in the past few weeks (was > away on holiday), which I think is great! Thanks :) > However, I'm wondering where's the limit? Or how far (which classes) > are you intending of taking this? I consider NSString, NSArray and NSDictionary. NSArray and NSDictionary has been completed. > arr = OSX::NSArray.arrayWithArray([1, 2, 3]) > arr.first > arr.last Yes. This works in most cases. But this doesn't work in destructive methods. (e.g. arr.shift) So current implementation copies the value in advance, calls a requested method, and then checks if the value is changed, recovers the value from the copy. That's why current method_missing implementation is slow. But even if we predefine methods, we need copying and recovering. Because Obj-C objects and Ruby objects have different values in their own space. In this case, I think the better way is to port methods of Ruby classes to Obj-C classes. It works with values in Obj-C objects not in Ruby objects. So we don't need copying and recovering values. -- Satoshi Nakagawa