Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't believe that is true, you can use class_replaceMethod to dynamically swizzle methods at runtime. This gets rid of compiler error and warning messages that appear when just using categories to override existing methods. From my understanding, the compiler enforces compilation unit visibility for methods implemented in a category, but the methods actually are actually added to the global scope.

There is no "top level" object or class_eval in Objective-C, so the situation is quite different from Ruby.

Here is an interesting paper about classboxes[1] (same concept as refinements), and the source code for the Objective-C runtime[2]. I found them to be useful in my research.

[1] http://rmod.lille.inria.fr/archives/papers/Berg05a-CompLangE...

[2] http://opensource.apple.com/source/objc4/objc4-532.2/runtime...



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: