w.kelly at qut.edu.au
Mon Apr 21 18:57:56 EDT 2008
Is anyone currently working on or have any ideas regarding the implementation of Module::module_function?
(this is where I'm currently stuck in trying to execute setup.rb for gems)
module_function is meant to take a list of names of instance methods and make then also callable as class (or singleton) methods.
It's easy enough to locate the existing methods using something like:
RubyMethodInfo method = (RubyMethodInfo)module.ResolveMethod(method_name);
(BTW, why doesn't ResolveMethod return a RubyMethodInfo?)
However, I'm not entirely sure how to programmatically create a new class method
(in Ruby.NET we had a helper method that would create a singleton for a module if one didn't already exist, but I'm not sure what the equivalent of this is in IronRuby)
Anyway, it seems that invoking:
creates a new method in the right place (provided SingletonClass has been properly initialized).
However, when I try calling such a method as a class method I get a wrong number of arguments exception, presumably because different parameters are expected depending on whether it is called as an instance method or as a class method.
More information about the Ironruby-core