Facilitating the spread of knowledge and innovation in professional software development



Choose your language

InfoQ Homepage News Scala+GWT Brings Scala to the Browser, New Documentation Site and Scala Days 2012 Announced

Scala+GWT Brings Scala to the Browser, New Documentation Site and Scala Days 2012 Announced

Leia em Português


Grzegorz Kossakowski has recently released the third milestone version of Scala+GWT. Scala+GWT allows you to write Scala code and then run it in the browser by compiling it to JavaScript via Google's Web Toolkit. This allows you to write statically checked code but with less boilerplate than Java requires.

InfoQ talked to Grzegorz to learn more about Scala+GWT. With the latest release, almost all language features are supported. The release notes mention that some pattern-matching features are not yet available, but will be in the next release. Are there any other limitations? 

Structural types are not supported and won't be without architectural changes in GWT.

InfoQ: Are there any features of Scala (the language or its libraries) that are particularly well-suited for GWT? Maybe Actors could be useful to communicate between the client and the server parts of the application. 

I've pondered a few ideas (including actors) but no work has been done so far on it. I'm deeply involved in compiler work and let other people explore their ideas. Also, integration with frameworks built on top of GWT would be interesting. One example is Vaadin. It's an interesting project and people behind it seem to be enthusiastic about Scala. This might be interesting for Scala because it would give it a better position as a language used to program good looking UIs.

InfoQ: Do you already have users that run Scala+GWT in a production website? 

I don't know about any such users. Actually, I used to deliberately lower people's expectations of Scala+GWT as I knew a bit more work is needed and we used to change internals a lot. That is also reflected in the version numbers I've been using: the latest release is marked as 0.1-M3. I expect the next release to be 0.1 and only then I'll be actively encouraging people to try it for real projects. This release should happen in a few weeks (before Christmas for sure).

In a much more detailed interview on, Grzegorz elaborates on the project's history and also explains how Scala+GWT is transformed to JavaScript. Using Java as the target for the Scala+GWT compiler was not an option because not all Scala programs can be mapped to valid Java code. So they introduced a new intermediate representation named Jribble, which is basically Java with these problematic restriction removed and some patches for GWT to make it understand Jribble input.

Performance is of course an issue with all these intermediate steps, but Scala+GWT also comes with an Eclipse plug-in that makes it possible to use GWT's development mode: 

In the development mode with Eclipse the [compilation] process is different. The compiler generates JVM byte code for the Scala code just as it normally would. GWT then runs this code in a JVM emmulator. When the code executing in the JVM needs to read or change browser state, this is done by sending an RPC to an attached browser which sends the result back to the JVM. When you change a line and recompile only the byte code classes that have been changed need to be reloaded in the JVM, rather than compiling everything right through to Javascript. This is very quick and takes a few seconds rather than minutes for the full server Javascript application build, even for a big application.

Scala+GWT is available on GitHub, and there's a walk-through on Youtube

New Documentation Site

As part of the ongoing effort to improve Scala's documentation, a new documentation website has been launched that serves as the entry point to the API documentation, several tutorials, a style guide, language references, and the official Scala Wiki. Users can also comment on all the pages. For contributions, the Markdown source of the site is hosted on GitHub, so it's easy for anybody to fork it and make additions or corrections. The site is built using Jekyll, a static site generator written in Ruby. 

Scala Days 2012

On April 17-18 2012, the third Scala Days conference will be held at the Barbican Conference Centre in London: 

Scala Days provides a unique opportunity for researchers and commercial Scala users to transfer leading edge research into production systems or share practical know-how on how to get things done more effectively.

More information will follow in the next months, in the meantime, you could watch some of 2011's or 2010's recordings.

We need your feedback

How might we improve InfoQ for you

Thank you for being an InfoQ reader.

Each year, we seek feedback from our readers to help us improve InfoQ. Would you mind spending 2 minutes to share your feedback in our short survey? Your feedback will directly help us continually evolve how we support you.

Take the Survey

Rate this Article


Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • A resurgence in meta-programming

    by Faisal Waris,

    • A resurgence in meta-programming

      by Faisal Waris,

      Your message is awaiting moderation. Thank you for participating in the discussion.

      Google has certainly shown the way with GWT but languages that intrinsically support meta-programming (e.g. LISP, Clojure, F#, etc.) make meta-programming much easier. Without meta-programming support in the language (e.g. Java, Scala) one has to work with source code which is messy and cumbersome.

      For example, the F# code snippet "<@ 1 + 1 @>" will not give you 2 but rather the Abstract Syntax Tree (AST) of the code text. The code within "<@ … @>" is type checked but not compiled as normal code; it is instead handed over as an AST. Sophisticated language facilities make it easy to traverse the AST and transform it as needed.

      WebSharper has exploited F# meta-programming well so that now they have integration with many javascript frameworks such as jQuery mobile and Sencha Touch (the exhaustive list is here:

      Microsoft’s Rosalyn project (compiler-as-service) is bringing meta-programming to C# and VB (presumably to more easily do what GWT does).

      Alan Kay makes a good case for meta-programming in his talk Programming and Scaling.


    • Re: A resurgence in meta-programming

      by Serge Bureau,

      Your message is awaiting moderation. Thank you for participating in the discussion.

      I might be wrong, but it seems easy to implement as a DSL in Scala.

      Of course if it is already provided natively, then less work ;-)

    • Good news

      by Serge Bureau,

      Your message is awaiting moderation. Thank you for participating in the discussion.

      Thank you for that !!! I am loking forward to the upcoming soon of version 0.1

    • Re: A resurgence in meta-programming

      by Steve McJones,

      Your message is awaiting moderation. Thank you for participating in the discussion.

      Isn't that what Scala is pretty much doing right now in the latest source?

    • Re: A resurgence in meta-programming

      by Faisal Waris,

      Your message is awaiting moderation. Thank you for participating in the discussion.

      as far as I am aware the scala language does not have any meta-programming capilities in the language itself. I believe that they are taking source code and converting it through external tooling.

      In F# you can do meta-programming as part of the language and can therefore easily mix 'programming' and meta-programming. LISP/Clojure is even more capable in this regard.

    • Re: A resurgence in meta-programming

      by Mirko Stocker,

      Your message is awaiting moderation. Thank you for participating in the discussion.


      No, Scala does not have the same kind of meta-programming capabilities, but there's a research project that adds some macro facilities. But what Scala has right now are plug-ins for the compiler, which lets you add things like String interpolation, or new back-ends like the one for GWT or .NET.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p


Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.