yazz.com
yazz.com

Reputation: 58796

How is google dart related to google closure?

I have just started using Google Closure and I have also heard about Google Dart which seems very similar. How are the two related?

Upvotes: 5

Views: 2669

Answers (4)

Sake
Sake

Reputation: 4133

I believe Dart was designed with Google Closure Compiler in mind from the very first start. The core principle underlying Dart's optional typing system is that:

"Striping type annotation should not effect the program behavior in production mode"

which match very well with Google Closure's comment-based type annotation system.

http://www.dartlang.org/articles/optional-types/

bar(int n) { return n *2;}
...
bar(3.2); // returns 6.4 in production, but fails in checked mode

Upvotes: 2

jtmcdole
jtmcdole

Reputation: 606

At the moment, DartC uses the closure compiler for optimized builds (--optimize). For a normal edit/refresh cycle, it generates javascript directly to gain some speed for the developer. The optimize (and closure phase) is more of a packaging and deployment step.

Upvotes: 2

Rich Dougherty
Rich Dougherty

Reputation: 3251

The Dart keynote speech should be happening soon (tomorrow?), but I thought I'd also add this excerpt from the Dash email.

What about the existing code bases for large Google Apps? Won’t they have to rebuild everything to take advantage of Dash?

The Dash Cross Compiler should be capable of taking typed Closure code (with some restrictions) and converting to Dash. Although the migration process won’t be fully automatic, it should make moving over to a Dash codebase somewhat easier.

Upvotes: 2

Chris Buckett
Chris Buckett

Reputation: 14398

Google closure, is a set of javascript libraries and a javascript parser for compiling and compacting your javascript. There are google closure tools that can be built into your build / deploy cycle.

Google Dart appears (from the current scant information) to be a language replacement for javascript, with the option for compiling to javascript. This is similar to what google GWT does now with java (ie, you write java and it compiles to javascript. I believe that this compilation process also uses the closure compiler).

This would be why the GWT + Closure teams have been moved onto the Dart project - it's vital for the takeup of Dart that developers can deploy client side dart applications to browsers that don't directly support dart (ie, non chrome). Cross compilation of dart to javascript (in the same way that GWT does java to javascript) is Googles method of solving this.

Upvotes: 4

Related Questions