I have discussed this with Laurent and will post the results here for completeness. The problem with the objc runtime is that if a method were to be removed and is called from the objc runtime, it would lead to seg faults. Therefor the warning is raised, so people don't have to look through stack traces. Fair enough. However, that's not what a Ruby user, like myself, would expect. So a solution we have discussed would be to change the behaviour of remove_method / undef_method on pure objc classes. It would remove the method and replace it with a stub which raises a NoMethodError. So the application would still crash, as expected, but with a sensible message. Some objc methods would probably still need the current warning, but only for methods like in Ruby Object#object_id and #__send__ etc. http://www.macruby.org/trac/ticket/197 Cheers, Eloy On Jan 5, 2009, at 1:09 PM, Vincent Isambart wrote:
Is there a good reason why MacRuby would need to warn the user about the hazzards of removing methods? Example: /Library/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/ site_ruby/mocha/class_method.rb:50: warning: removing pure Objective-C method `__stubba__require__stubba__' may cause serious problem
If you read well the error message it warns for removing a *pure Objective-C* method. It does not warn for methods defined in normal Ruby. If my memory serves me right, removing a method is not supported by the Objective-C runtime. There is a work around to do it, by MacRuby is probably one of the rare applications to do it so it may cause problems.
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel