Tuesday, April 1st, 2008

Google releases GWT for JavaScript 2

Category: GWT, JavaScript

GWT for JS2

The Google Web Toolkit has long been a bastion of Java developers who are able to chant “We don’t want your stinking JavaScript!”

GWT is a lot more than a client side framework that allows you to write code in Java. It is a productivity tool that lets you developer and test a solution that performs well and works cross browser (huge wins). In fact, when I talk to people that are using GWT, the most common comment that I hear is how happy they are with:

  • How the application just works cross browser
  • How great it is to get a new version of GWT, run the new compiler, and get substantive performance improvements

Why should this just live in a Java world? Today, it breaks out. Google has released GWT for JavaScript 2.

With the upcoming birth of JavaScript 2 hopefully hitting our browsers, wouldn’t it be nice to build your Ajax applications using JavaScript, but also having the cross browser helpfulness that GWT gets you.

How does it work?

You write an application using JavaScript 2, and you then run it through a compiler which spits out the same optimized JavaScript source code that works for the various browsers.

Why write cross browser JavaScript when you can just write JavaScript?

This fits in perfectly with Steve Yegge releasing js2-mode, a new JavaScript 2 module for Emacs that has a lot of great features:

  • Asynchronous highlighting
  • Code folding
  • Comment and string filling
  • Syntax errors
  • Strict warnings
  • jsdoc highlighting

Also, Didier has posted the news that GWT has been submitted to the JCP as JSR 404.

Posted by Dion Almaer at 12:24 am

3.1 rating from 27 votes


Comments feed TrackBack URI

Compile javascript into javascript? :) Is that google’s april 1 joke?

Comment by sandrejev — April 1, 2008

nice attempt Dion :D
“Tuesday, April 1st, 2008”

Comment by Adnan Siddiqi — April 1, 2008

It’s going to be a long day.

Comment by savetheclocktower — April 1, 2008

April fool notwithstanding, this is of course a very good idea and neatly solves the javascript 2 dilemma (the dilemma being that IE will never implement it, and plugin solutions will never be the best answer). Write apps in JS2, let them run natively in JS2 browsers and have GWT emit old-school javascript for IE, brilliant, and never have to touch no stinking java !

Comment by heswell — April 1, 2008

Google already have a JSCompiler tool which performs static analysis and optimization on JavaScript. Apart from the lack of any standard JavaScript class libraries, it’s easy to see JSCompiler being used in this hypothetical way.

Comment by RichB — April 1, 2008

Aha, but is it technically even a compiler. A code optimizer at most I would say!

Comment by sandrejev — April 1, 2008

heswell: it’s an open question how poorly plugins will perform, compared to “lowering” JS2 to JS1. ScreamingMonkey lives, Mark Hammond has it running inside IE, doing the Mix07 chess demo that Microsoft showed with C# and JScript versions.


Comment by BrendanEich — April 1, 2008

I’m sure you’re right regarding performance, and I can’ t wait to play with ScreamingMonkey, my reservation regarding plugin solutions is more about deployment/availability – a plugin is only good if my user has it installed. If they do and this can be detected…fine, let them benefit from JS2 as well, but if not, then give them generated jscript 1.5.
I don’t really beleive GWT will deliver this, but it seems a plausible approach.

Comment by heswell — April 1, 2008

Interesting… nice shot at the April fools tradition :-)

I can’t help but wonder how much this seeming joke is meant to signal actual intent/thought. I’ve certainly thought of doing something similar with Script#.

Comment by NikhilKothari — April 1, 2008

I for one love the high-level programming styles afforded by JS, and find Java repulsively verbose by comparison, but I *do* envy the browser elision that GWT supplies. I was really hopeful for a minute here, because Reader had timestamped this March 31st.

In response to an earlier comment, the Google compiler is a “real” compiler, not just a minifier.

Comment by gavindoughtie — April 3, 2008

Leave a comment

You must be logged in to post a comment.