Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does CodenameOne support other JVM languages besides Java?

CodenameOne supports compiling Java code down to native iOS binaries. Does it support other JVM based languages such as Clojure or Jruby ?

like image 750
Ivar Avatar asked Sep 25 '22 20:09

Ivar


1 Answers

Not out of the box but its indeed possible. In the past Steve ported Mirah which is a Ruby subset to run on Codename One. This was when we were using the old VM but should work with the new VM too.

A community member was also able to port Haxe a while back but I'm unsure where that ended.

The main point of contention when porting a JVM language is that Codename One doesn't support reflection and so a duck typed language implementation that generates reflective code would be "problematic".

The reason for avoiding reflection is quite simple, the code size would grow tremendously effectively negating a lot of the advantages of the smaller handcoded VM. Its also quite hard to optimize reflection code in an AOT environment so it will perform badly when compared with a JIT.

A lot of the usage of reflection can be replaced with bytecode manipulation ahead of time so the VM can work as if its standard Java code even when it isn't.

We generally like the idea of running other languages on top of Codename One and would like to help if you run into issues. The main reason we don't invest time in these things ourselves is to keep our focus in place.

like image 102
Shai Almog Avatar answered Sep 30 '22 14:09

Shai Almog