Hi there,
I’ve been thinking about how Red Bridge (embedding API) can use
ruby2java (http://kenai.com/projects/ruby2java) compiler and load
compiled Ruby scripts. When ruby2java compiler is used, Ruby scripts
are converted into Java bytecode. Probably, we can expect better
performance on Red Bridge since it is Java API. However, there is no
way to use ruby2java compiler from Java right now. We need some
mechanism to be invented.
Currently, three ways to use compiler are come up with in my mind.
The first plan is compile ruby2java itself by ruby2java so that Red
Bridge can invoke a compiler method in a Java way. Good side of this
plan is that the performance is not bad, and changes to ruby2java can
be reflected immediately. The problem is I couldn’t compile ruby2java
because of the error below:
$ bin/ruby2java Ruby2Java lib/ruby2java.rb lib/compiler.rb
lib/compilable.rb lib/compilable/annotation.rb
lib/compilable/extends_class.rb lib/compilable/interface.rb
lib/compilable/package.rb lib/compilable/signature.rb
./lib/compiler.rb:33:in process_class': undefined method
ruby2java_compilable?’ for Ruby2Java:Module (NoMethodError)
from bin/ruby2java:19
The second plan is just to evaluate ruby2java script using Red
Bridge’s embedding API. This would be the easiest but maybe the
slowest.
The third plan is to implement ruby2java in Java. This might be the
most effective for Red Bridge, but is not easy. Besides,
implementation in Java must catch up with the changes of ruby2java.
In any plan, compilation of a Java code that uses compiled Ruby
scripts might have a problem because *.class files are not exist
before Ruby scripts are dynamically compiled. Maybe a Java interface
helps to solve the problem.
If somebody has opinions, ideas or thoughts, let me know about that.
-Yoko
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email