This is just a simple front-end/demo. The real work is being done by a separate project at <a href="https://github.com/mysema/scalagen" rel="nofollow">https://github.com/mysema/scalagen</a>.<p>I kind of wished this site was written in Java and run through scalagen with the output being run as an additional meta-demonstration.
I don't know scala so maybe I'm missing something, but does this just break with functions that start with a switch statement? eg.<p><pre><code> public static void main(String[] args) {
switch (42) {}
System.out.println("Hello World!");
}
</code></pre>
converts to<p><pre><code> def main(args: Array[String]) 42 match {
}
</code></pre>
dropping the println.<p>Edit: It also seems to be dropping autoincrement/decrement, and random other blocks of code I've looked at, so I guess it's still in a fairly early stage.<p>Definitely a cool project though :)
I also noticed this in IntelliJ when I went to copy some Java into a Scala project. As I began converting the Java code to Scala after the copy I was extremely confused when I found that the pasted code was already converted for me.
Earnest question: who is the target audience here? If Java and Scala can be intermixed in the JVM, and the generated Scala code is not very idiomatic, then how would this be used?
This is a neat project. I have a giant codebase I'd like to try this on. Depending on the output, this might be the kick in the pants I need to get in to scala full time.
Intellij IDEA has had Java to Scala conversion built into it for a while (as well as Java to Kotlin, Jetbrain's new JVM Scala-like language). I'm not sure how Jetbrain's tool compares to the one in the link above, but the conversion result in Intellij varies by how complicated and dependent the code is on other packages/libraries. Converting an entire class file tends to work out much better than a single method.<p>I initially used it to convert some Android code in Java to Scala, but much of the time you have to end up rewriting that as well, since it's generally results in very non-idiomatic Scala code. Still useful for someone learning Scala though as others have pointed out.<p>The Scala plugin is free though and comes with the community edition of Intellij for anyone wanting to try it out. Basically you just copy/paste some Java code from the current project into a Scala file or right click on the Java file and select "convert."
So now I am really wondering. What is the sub java parts of the JVM that need to be implemented to completely free Scala from the JVM ( i.e. what C interfaces are needed to allow scalc to compile to LLVM or comparable VM)