[MacRuby-devel] MacRuby 0.5b1: Tinkering with -[NSObject hash]

Frank Illenberger illenberger at mac.com
Fri Nov 13 06:16:57 PST 2009

Hi everybody,

I just found out the hard way, that initializing the MacRuby runtime seems to alter the values returned by -[NSObject hash] even for objects of non-ruby classes. In my Objective-C application, I am loading the MacRuby runtime lazily once the user needs to load a Ruby plug-in. This immediately destroys all NSDictionaries/NSMapTables/NSSets that have been filled with objects before the loading. 
The only workaround I have found so far, is to call -[MacRuby sharedRuntime] early at the start of the application, but this results in an unnecessarily slower startup time and a larger memory footprint. 
Is the change in the hash values meant by design or might it be a bug in MacRuby?



More information about the MacRuby-devel mailing list