I was thinking that especially when testing the performance of a pure ruby 
based class (Set) against a Cocoa class (NSSet/NSMutableSet), it would be 
useful to alias methods in the Cocoa side of things. My thought was then you 
could have a single API to use in the rest of your code and you can just switch 
which class you are using.

In my case I wanted to alias include? to containsObject and add to addObject.

I suppose that this could also be done by aliasing on the ruby side of things 
(alias containsObject to include?), right now I just create methods that 
forward for me.

What I was wondering is if it would be useful to be able to have something like 
this work in the future:

{{{
class NSSet
    alias include? containsObject
end
}}}

Right now you will get "only pure Ruby methods can be aliased 
(`containsObject:' is not) (ArgumentError)". But I was thinking maybe when it 
sees that the original method is pure ruby it could act as it currently does, 
but then when it sees an Objective-C method as the original it could do 
something like on the Objective-C side use method_getImplementation() and 
method_setImplementation() to create the alias for you anyway.

Would this be desirable? Should I create a ticket for it?

Jordan

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to