Hi guys.

So, anyone who have looked at our code knows that an annoying part of the setup of each Ruby class is a long list of CallbackFactory calls. Brixen of Rubinius just showed me part of their FFI, which would make total sense for our purposes. What the example looks like is this:

s = Compression::ZLib.deflate("test")
Compression::ZLib.inflate(s) module F
attach_function nil, "compress_inflate", :inflate, [:state, :string], :object
end
F.inflate(nil, s)

In our case, we could have a part of Kernel look like this:

module Kernel
 attach_method "org.jruby.RubyKernel", "new_array", :Array, [:object]
 attach_method "org.jruby.RubyKernel", "new_float", :Float, [:object]
end

I think that would be much better than our current solution, and also easier for third party extension developers.


Cheers

--
Ola Bini (http://ola-bini.blogspot.com) JRuby Core Developer
Developer, ThoughtWorks Studios (http://studios.thoughtworks.com)

"Yields falsehood when quined" yields falsehood when quined.



---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to