I'm tossing this patch out here so recent contributors can have a look too. Perhaps everyone knows that Object doesn't actually define any instance methods; they're all mixed in from Kernel. However, in order to have them be properly callable in JRuby, they all actually exist on Object (semantically, that's where they appear to be in Ruby too). This, however, causes some method-related tricks to fail...specifically, the DelegateClass in the delegate library depends on Kernel#public_instance_methods returning all the methods you'd normally expect to see on Object. It subtracts this list from the list of all public instance methods on a target class to be delegated to, thereby producing a list of only the methods which should be delegated.

The attached patch fixes this. It has been around for better than a week, but it only exists on my branch. I'm not entirely happy with the new RubyModule.definePublicModuleFunction, because it doesn't seem quite in the spirit of how module functions work; however, I'm not entirely positive the correct way for module functions to work internally so that Kernel#public_instance_methods will show the right list. This patch seems to fix all issues, but I'd like to hear opinions (and I'd certainly like those of you using this on projects to try JRuby HEAD with this patch added).

You'll need this patch if you intend to play with Rails' generate script at all, as well. generate works on my branch, but not yet on HEAD (and probably not in the upcoming 0.8.3 release, unfortunately).

--
Charles Oliver Nutter @ headius.blogspot.com
JRuby Developer @ jruby.sourceforge.net
Application Architect @ www.ventera.com

Attachment: object-modules-in-kernel.patch
Description: Binary data

Reply via email to