Can Scala be used to write GWT applications?

Viewed 8715

Can Scala be used to write GWT applications?

(NOTE: Java/Scala novice here...)

7 Answers

Short answer is GWT can call into a program written using Scala. The most popular web framework written in Scala is Lift - http://liftweb.net/ and would be an alternative to GWT if you wanted a pure Scala solution.

GWT is a web framework written using Java. The client side is written in the Java Language and compiles into JavaScript and the server side is written in Java and can use any resources available in the Java JVM. Scala is a language that compiles into bytecodes that are executable on the JVM and can interact with standard Java programs as well.

The GWT compiler works with Java source code because that provides the most visibility to allow for optimisations when compiling into Javascript. There has been occasional discussion about working with the bytecode, but the issue always ends up being that a lot of optimisations will be lost if the compiler works with byte code and not source code.

Nevertheless, there is an interesting thread about supporting Scala. However, the priorities for the GWT team at this point seem to be more focused on the Java language compiler.

If you mean Google App Engine, the service for hosting web applications, the answer is yes.

If you really mean Google Web Toolkit, the tools for compiling Java into JavaScript to run in the browser, I pretty sure the answer is no. GWT does all kinds of code analysis when compiling to JavaScript and this relies on having Java source files as well as .class files.

Related