Saturday, May 5, 2012

Scala to JavaScript compilation




Wolfgang Kühn, a member of the trading development team at EnBW Energie Baden-Württemberg AG, explains in his talk at ScalaDays how they are able to translate Scala into Javascript using j2js. With this they can now develop both the front-end and the back-end using the power of Scala along with the advantages of static type checking. He says that ENBW trading uses Lift, based on Scala, for their web servers and plan to use Scala for the client instead of Javascript. This ability to create rich web clients in Scala is an important part of their development strategy.



This is a proof of concept for cross compiling Scala to JavaScript. The main ideas are outlined in the paper Running Scala in the Browser and a talk (pptpdf).

Running ELIZA@Web

The demo is online at ELIZA@Web. It uses the ELIZA implementation by Sven Panitz.

Building ELIZA@Web

  1. Set up maven.
  2. Download the ELIZA@Web project.
  3. On command line, change into the project and execute mvn package
  4. In target/j2js-scala-demo-0.3-SNAPSHOT you now find the executable demo. It can be run with or without a web container.

Video

For the best quality, click on the zoom button in the right corner.
Playback buffering? Try the lower quality version. You can also download the mp4 version.
Presentation slides (pdf). Additional files and demo at this page.


Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

0 comments: on "Scala to JavaScript compilation"

Post a Comment