Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Mobile Ruby Roundup: Symbian Ruby 1.9, Android, JME, iPhone and Mono

Mobile Ruby Roundup: Symbian Ruby 1.9, Android, JME, iPhone and Mono

Leia em Português

This item in japanese

A port of Ruby 1.9 for Symbian is now available, a Ruby 1.8 version has been available for some time (as well as Python for Symbian).

Besides Symbian's Ruby, there isn't too much support for Ruby on mobile phones right now.  It's possible to run Ruby's ARM version on Android.

Since Android is Java based, another option would be to get JRuby to run on Android. One issue is that Android doesn't execute Java bytecodes, but instead Dalvik bytecodes (JVM bytecodes have to be translated to Dalvik bytecodes). In a discussion on the jruby-user list, JRuby's Charles Nutter lists possible solutions:

There's two possible execution scenarios that would work with these limitations:
* Pure interpreted, where all code gets parsed on the device and executed with our AST-walking interpreter logic. This would probably be slower than we'd like, but easy to make work.
* Pure compiled, with all invokers/handles generated ahead-of-time as well.
Both cases are already possible in the current codebase; the only trick would be producing a deliverable .jar that provides only the one and has no dependencies on the other.

Running JRuby on JME is is not really an option today. A port of JRuby to JME was presented at JavaOne 2007. The Zip file at the linked location contains the slides of the JavaOne presentation, which details the process involved in getting a subset of JRuby to run on JME. Since JME is a cut down version of Java, getting JRuby to run involves a rewrite of large parts of JRuby. JRuby's current versions rely on Java 5 - but as the slides show, JME lacks classes and methods added as far backs as Java 1.2. Among the bigger omissions are Regular Expressions or large parts of the Collections API.

Another option might soon become available in the form of IronRuby and Mono for the iPhone. While the iPhone AppStore doesn't allow to download interpreters, the latest Mono versions have a solution: Ahead of Time compilation, ie. code in CIL is compiled to CPU instructions, in the iPhone's case to ARM instructions. Since IronRuby can compile Ruby code to CIL, instead of interpreting them, it's possible to compile a Ruby application down to CIL, AOT compile it and run that on the iPhone. As Miguel de Icaza mentions, a few minor issues remain before IronRuby code can be made to run:

Of course, once you remove the JIT you will not be able to use any dynamically generated code. This means no Reflection.Emit dynamically and at least for the time being or no IronPython/IronRuby.
John Lam told me at the PDC that they are looking into bringing static compilation for IronPython/IronRuby/DLR back, so this might just be a short-lived limitation.

Rate this Article