2011-09-11

Google Dart to “ultimately ... replace JavaScript”

Updates:
  • New post 2011-10-10:Google Dart – overview and comments” (with all the information from the official Dart launch at the GOTO conference)
  • New post 2011-09-13:Google’s Alex Russell on JavaScript versus Dart
  • 2011-09-14: Rewrote of the section “What does it all mean?” and added new material on universal virtual machines. Added Crockford quote under “Other voices on Dart”. Added a conclusion.
  • 2011-09-13: More on Eich’s comments at Hacker News.
The following keynote will be held at the GOTO Aarhus 2011 Conference on Monday, Oct. 10, 2011:
Dart, a new programming language for structured web programming
This post explains what Dart is all about and how it relates to JavaScript.

Google’s strategy for JavaScript

Unless another source is mentioned, all of the following quotes come from a Google email that was written in November 2010. It summarized a Google-internal discussion:
On November 10th and 11th, a number of Google teams representing a variety of viewpoints on client-side languages met to agree on a common vision for the future of Javascript.
The agreed-upon “common vision” was to develop a new programming language called “Dash” (which was later renamed to “Dart”).
The goal of the Dash effort is ultimately to replace JavaScript as the lingua franca of web development on the open web platform.
In order to minimize the risk of failure, Google will hedge its bets:
Javascript has fundamental flaws that cannot be fixed merely by evolving the language. We'll adopt a two-pronged strategy for the future of Javascript:
  • Harmony (low risk/low reward): continue working in conjunction with TC39 (the EcmaScript standards body) to evolve Javascript
  • Dash (high risk/high reward): Develop a new language (called Dash) [...]

Dart (originally Dash)

Dart’s goals are (quoting verbatim from the email):
  • Performance – Dash is designed with performance characteristics in mind, so that it is possible to create VMs that do not have the performance problems that all EcmaScript VMs must have.
  • Developer Usability – Dash is designed to keep the dynamic, easy-to-get-started, no-compile nature of Javascript that has made the web platform the clear winner for hobbyist developers.
  • Ability to be Tooled – Dash is designed to be more easily tooled (e.g. with optional types) for large-scale projects that require code-comprehension features such as refactoring and finding callsites. Dash, however, does not require tooling to be effective--small-scale developers may still be satisfied with a text editor.
There will be several ways of running Dart:
  • Dedicated VM: as a substitute for JavaScript, in all browsers.
  • Server: with the goal to enable “Google-scale” web applications where front end and back end are written in the same programming language.
  • Cross-compiler: that compiles Dart to ECMAScript 3 on the fly, for compatibility with non-Dart browsers. Compare to Google Traceur [2] which compiles ECMAScript.next [1] to ECMAScript 3, in a similar manner.
The FAQ at the end of the email makes it clear that Google intends to use Dart wherever it can (at least in the web space). It also makes it clear that Google expects the migration from JavaScript to Dart to take a while. There will be a tool to help with the migration:
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.
Hidden in the FAQ: Google is working on a “cloud IDE (Brightly)”.
Brightly will enable building any web application in V1 using today’s Javascript plus the additions in Harmony. As soon as it is ready, Brightly will support Dash as well. We expect that the more prescriptive development aspects of Brightly that will come on line in the future will be more Dash focused.

We expect Brightly itself to be the first application written in Dash.

What does it all mean?

Consequences for ECMAScript.next [1]. Just as ECMAScript is making tremendous progress, Google decides to throw their weight behind a completely new programming language. I wouldn’t mind that if Google’s strategy really was two-pronged, if they gave the same consideration to JavaScript:
  • Keep the ECMAScript.next-to-JavaScript compiler Traceur up to date.
  • Create an IDE that is as good at ECMAScript.next as it is at Dart.
Mainly the latter does not seem likely. I also hope that Google does not put the main focus of its ECMAScript work on features that help with compiling Dart to it. The email sounds like it, Alex Russell does not. Contrast that with Microsoft’s approach of writing several core Windows 8 apps in standard HTML5 [5].

Will it be technically sound? The three goals for Dart are spot-on. I love that they are focusing on toolability, an area in which JavaScript currently has severe deficiencies, especially compared to Java. The goal of “developer usability” ensures that the language will remain lightweight. There are brilliant people working on it – that have both compiler expertise and language design expertise:

Who authored this document [the email introducing Dart/Dash]?

Brad Abrams, Erik Arvidsson, Lars Bak, Darin Fisher, Dimitri Glazkov, Dan Grove, Peter Hallam, Bruce Johnson, Alex Komoroske, John Lenz, Kasper Lund, Mark Miller, Ivan Posva, Alex Russell, and Joel Webber, who collectively represent TC39 (the EcmaScript standards body), WebKit, Parkour, Brightly, JSPrime, JS++, Closure, JSCompiler, V8, Dash, Joy, and GWT, among others.

For example: Gilad Bracha has great taste in language design, his work on Newspeak and pluggable type systems [PDF] is exemplary. Newspeak is currently the best guess for what Dart will look like – given that both of the presenters at the GOTO conference have worked on Strongtalk. Strongtalk is a language that added an optional static type system to Smalltalk, a dynamically typed language. This approach would go together well with the Dart goal of “developer usability”. Newspeak is in many ways an evolution of the Strongtalk ideas. Furthermore, an IDE has always been at the core of Newspeak’s design which jibes with the “ability to be tooled” of Dart.

Is Dart really open? Let’s first recap how uniquely open JavaScript really is – there is no other programming language that is as open:

  • With ES-262 (ECMAScript), JavaScript has a very precise, easy-to-read specification. Doing such a specification well is much work, but it is essential for ensuring that all JavaScript engines remain compatible. Ironically, back in the day when Netscape had a browser monopoly and Microsoft had to catch up, Microsoft pushed for this kind of standardization to initially happen. All major browser vendors and the public collaborate to evolve ECMAScript. However, the core group working on the design is relatively small, works together well, and prototypes most of the proposals. That avoids many “design by committee” problems.
  • There are several competing implementations. That might sound like a disadvantage, but it isn’t: It leads to a robustness of the JavaScript ecosystem and pushes innovation. For example, Firefox borrowed ideas from Google’s V8 to make their JavaScript faster.
In contrast, Dart is almost proprietary: It is not developed in the open and only shown to the public once it is finished (Brendan Eich calls this “delayed-open”). Plus, all of the developers work for Google. It’s great that it is free and eventually open source, both of which will help its popularity. But it probably will never be nearly as open as JavaScript – Google does not have a good track record when it comes to writing specifications for things it open-sources. A recently leaked Android email reminds us that Google is not always as innocent about openness as they sound. Quoting it verbatim:
  • Do not develop in the open. Instead, make source code available after innovation is complete
  • Lead device concept: Give early access to the software to partners who build and distribute devices to our specification (ie, Motorola and Verizon). They get a non-contractual time to market advantage and in return they align to our standard.

Will other browser vendors adopt it? If you are a competing browser vendor, your prospects for adopting Dart are as follows:

  • It is difficult to integrate into your existing infrastructure (as you couldn’t give early feedback).
  • Its development is mainly controlled by Google.
  • You give Google a head start of over two years.
That’s not very appealing. With that background, Google’s plan for involving other browser vendors sounds naive:
What if other browsers don’t follow us with Dash?

Lars has promised to “sweet talk” the other browser vendors and, while we are all eager to see this, we recognize this is a very difficult road. Our approach is to make an absolutely fantastic VM/Language and development environment and build great apps that fully leverage it in order to help other browsers see the wisdom in following. Once Dash has had a chance to prove its stability and feasibility, we are committed to making Dash an open standard with involvement from the broader web community.

It is not a good sign that Brendan Eich, a guy who really works his behind off to involve the community in the design of ECMAScript.next has not been approached, yet. He should be the first person for Google to target with their “sweet-talking”. Oh, and how is that for sweet-talking [emphasis is mine]:
Why are you circumventing the standards process?

We fully intend to cooperate fully with standards processes--the problem is that the current standard processes are limited to Javascript, which is not viable in the long term. Any effort with the historic baggage that Javascript has will be extremely limited. We need to make a clean break, make progress, and then engage the community.

That is an incredibly simplistic statement. How can they possibly predict what JavaScript will look like in the long term – a language that is currently very minimal and thus easily extended? The above statement would also sound better if Google mentioned their own motivations, something along the lines of “we want to try something different and to (initially) go it alone”.

Isn’t Dart similar to CoffeeScript? Yes and no. To run either Dart or CoffeeScript [3] on a JavaScript engine, you will have to perform a translation step. However, CoffeeScript intentionally stays close to JavaScript semantics which means that it is a transpiler (only local transformations), while Dart will probably need a compiler (that makes sophisticated non-local transformations). Source-code-level debugging is in store for CoffeeScript [4], but it’ll be much harder to implement for Dart. Thus, Google Chrome with a dedicated Dart VM will probably be the best way to run Dart for a long time and that could considerably fragment the open web.

Why not just standardize a universal virtual machine and compile both JavaScript and Dart to it? Brendan Eich has talked about this. Byte codes are always tightly coupled with the language they support, so finding an approach that everyone is happy with is practically impossible. Intellectual property rights are another challenge. Years ago, the Java Virtual Machine had the potential to become the “web virtual machine”. But things went differently and Sun ignored the client-side of the web while Ajax took off. Source code is the byte code of JavaScript, possibly with more compact syntax representations in the future. It seems weird, but it works surprisingly well.

Other voices on Dart

Brendan Eich:
Here is something that the Google leak about Dart (née Dash) telegraphs: many Googlers, especially V8 principals, do not like JS and don’t believe it can evolve “in time” (whatever that might mean — and Google of course influences JS’s evolution directly, so they can put a finger on the scale here).

They’re wrong, and I’m glad that at least some of the folks at Google working in TC39 actually believe in JS — specifically its ability to evolve soon enough and well enough to enable both more predictable performance and programming in the large.

There’s a better-is-better bias among Googlers, but the Web is a brutal, shortest-path, Worse-is-Better evolving system.

I’ve spent the last 16 years betting on the Web. Evolving systems can face collapses, die-offs, exigent circumstances. I don’t see JS under imminent threat of death due to such factors, though. Ironic that Google would put a death mark on it.

Gilad Bracha [one of the people behind Dart]:

Lots of speculation about Dart; few facts. All will be revealed at GOTO Aarhus.
More from Eich on Hacker News (part 1/3):
On Dart: Google as a single entity does not know what could be done in Ecma TC39, since the Dart/V8 principals never participated, and V8 needed a fresh-thinking second team finally to get going on Harmony prototyping.
...
Innovating in the open and proposing early and often to standards bodies are fine. Delayed-open-washing and increasing piles of proprietary (open-source doesn't matter) single-vendor code, which implements features that are not ever proposed for standardization, are not.
More from Eich on Hacker News (part 2/3):
For the record, I'm not worried about JS being replaced by a better language. I am working to do that within Ecma TC39, by evolving JS aggressively.

The leaked Google doc's assertion that this is impossible and that a "clean break" is required to make significant improvements is nonsense, a thin rationale for going it alone rather than cooperating fully.
...
Dart is GBScript to NaCl/Pepper's ActiveG.

More from Eich on Hacker News (part 3/3):
Look, Netscape had a monopoly and put JS "on first" and just about everywhere. I'm done apologizing for that, I've made up for it in spades on standards work, and it's a fact I cannot recall and rewrite.

The precise point now, here on planet earth and not wherever you are, is that Google is not that new monopoly. Not yet, not likely for years even in their wildest dreams.

If Google were the monopoly Netscape was, sure: Dart would be the new JS. The two would co-exist for a long while but "replacement" would be conceivable so long as market power held up.

Since Google does not have monopoly power, and with the non-standardizing tactics of that leaked memo, Dart is unlikely to be adopted by other browsers. It's fragmenting. It's an invitation to others to inject their own would-be replacements and build a Tower of Babel.

Douglas Crockford in an interview on DZone:
DZone: Finally, what did you think about the news of Google's new "Dart" language to replace JS?

Crockford: Google has not shared any information with me. Of the little bits they have leaked, some of it looks good. Some of it looks very, very bad. It is too early to draw any conclusions.

Conclusion

My main question for Google is: What can Dart do that ECMAScript.next and Traceur can’t? We’ll have to wait until Oct. 10 to get an answer. It will be an interesting event.

References

  1. A brief history of ECMAScript versions (including Harmony and ES.next)
  2. Google’s Traceur: compile ECMAScript.next to JavaScript on the fly [see the section on “Caveats” regarding a lack of community involvement]
  3. CoffeeScript – overrated?
  4. SourceMap on Firefox: source debugging for languages compiled to JavaScript [update: WebKit, too]
  5. A Windows 8 keynote review by a JavaScript programmer and Apple user

34 comments:

Dude said...

Not interested Google. If we can't get everyone to agree to the JS standards after how many years, what makes Google think it can get everyone to agree to the Dart standard? It thinks that just because it's Google it can say it and make it so?

Plus, I'm disillusioned with Google's definition of "open". Let's see that honeycomb source, for example.

Axel Rauschmayer said...

I agree. What makes it worse is that TC39 currently *is* working quite efficiently. ECMAScript.next will be great, so there really is no need to throw out the baby with the bathwater.

Mehdi Avdi said...

Hah, I welcome all JS developers to the "Dead Flash" corner. You guys just looked so invincible.

Problem is, crippled language will bring crippled logic, good luck making that move to Dart, Java, Objective-C, C# etc.

Homelessness? Nah, dont worry you can always support older systems

VitaminP said...

Even if Dart fails to spread to a broad base of developers, it should light a fire under the collective ass of the ECMA standards community.  That's it's secondary purpose, I suspect.

Peter72 said...

"Google Wave to ultimately replace e-mail"

Steven H. said...

It means my browser won't work, and Google is just another Microsoft.

Foljs said...

Yes, because a vague announcement of a single vendor new language will totally change the web field. You should be worrying more for your comprehension skills if you came to the conclusion that JS is doomed from an announcement such as this.

And I have some beachfront property in Nevada to sell you.

Anon said...

This language needs to die in a fire! Another Google mistake...

Mehdi Avdi said...

My comprehension skills have served me well, Thanks very much. It is obvious that JS is not a language for large projects involving more than 5 developers.

I am a JS programmer myself, (boy was the transition from Flash to anything easy) and it is fairly obvious in our team  and any team that the language wasn't designed for full featured web apps.

This announcement comes after many that JS has to change or be replaced completely, damn more and more people are going towards CoffeeScript and I see why.

This is a trend, and it is facing downwards. See TIOBE index for your proof. JS delta has been falling for a year now.

Pete Wood said...

beachfront in Nevada? tell me more, I have financial backing from my Nigerian uncle!

Leon said...

God I hope JavaScript goes the way of the dodo.

Vladimir Cvetić said...

CoffeScript is just cosmetic change, that been sad I see why too. People like pretty things.

Aly-Bocar Cisse said...

I thought exactly the same thing lol.
I'll just wait and see.

Keeny-Youn said...

Lot of you guy talk with non-subjectivity, Dart won't kill JavaScript (and it can't) but will be an alternative and a concurrent, developers will try it out and choose if it's worthy to be used as an alternative, else, no one forces us to use Dart and no one forces us to stay with JS. So, we should just wait now.
Regards.

Axel Rauschmayer said...

I’m curious: What is it that people don’t like about JavaScript? I do admit that it has warts, but if you get to know it, it can be quite elegant. And ECMAScript .next has many nice things in store.

For me the main JavaScript pain point is IDE support.

Axel Rauschmayer said...

That will be a positive side effect, I hope. But Bracha et al. are all about creating new languages, so I doubt their motivation was to improve JavaScript (especially considering the wording in the email where they describe JavaScript as being beyond repair).

Note that TC39 (the part of Ecma that works on ECMAScript.next) does great and efficient work. What sometimes gets in the way are the companies they work for (the major browser vendors) which have their own political agenda. Dart might push those companies to be more flexible about adding new features.

ECMAScript.next will be great, has been designed by prototype implementations (not “by committee”) and will be available quite soon (by the end of 2013). Give it a chance!

Axel Rauschmayer said...

My experience has been the exact opposite (and TIOBE reports should always be taken with a healthy helping of salt): I see tremendous interest in JavaScript everywhere.

If you use ECMAScript 5 (possibly including a shim to support older browsers), programming JavaScript *can* be quite pleasant.

What is it you don’t like about JavaScript – what were the problems you encountered?

It seems to me that working in teams with JavaScript is difficult because IDEs are still limited (and there is a lot you can do in that area: static analyses, refactoring etc.). Once that changes, using JavaScript in teams will be a more pleasant experience. For me, Eclipse made it more fun to program Java than Python and Python is clearly the more elegant language of the two.

Axel Rauschmayer said...

Google could have thrown its resources behind ECMAScript.next, via Traceur and a killer IDE (developing a good one takes lots of man and brain power).

Ironically, that is what Microsoft will do: http://www.2ality.com/2011/06/erich-gamma-microsoft.html

Mehdi Avdi said...

JavaScript is structured (well that is an overstatement) in a way that it makes it really hard and near impossible to create proper IDE's for it. 

Lack of type definition is already hurting high performance web apps. It is very clear the language wasn't made for this day and has reached and passed its limits.

Absolutely right about Java and Python, imo, Prolog is the most enjoyable language of all, but the way it is made, makes a good experimental language but no one ever goes near production with it (Except a few nutters) Same applies to JS.

Just look at the exit ways people are seeking out of this mess, Google Web Toolkit, Objective-J, even SproutCore is aimed that reducing the pain with JS. All Google is doing now, is facing the problem head on. Problem is the language, not the engines nor the developers. There is ever so much can be done to improve something.

Next phase of web needs something more robust, more efficient.

Guest said...

The only thing wrong with JS is that Apple and Google ship an older version; Google has chosen to implement exactly as much in V8 as what Apple's Squirrelfish supports. JS1.8 is a pleasure to use.

Axel Rauschmayer said...

V8 is very efficient, even with current-day JavaScript! And (quoting myself): “there is a lot you can do in that area [of IDEs]: static analyses, refactoring etc.”

Do take a look at what’s planned for ECMAScript.next, you might be pleasantly surprised.

GWT is an interesting example: The main motivation for using Java was because it had such good IDE support. You could bring JavaScript up to almost the same level of support, but don’t forget that IBM has paid lots and lots of money to get Eclipse to where it is today. Developing an IDE is not cheap!

Wander said...

Im more interested in that Brightly
I still havent seen an online IDE that does a good job

Mehdi Avdi said...

Yet the same guys involved in development of V8 are working on Dart?

Just looked into approved changes for new version of ECMA, indeed I do welcome most of them, after all it seems the old rumor of JS turning into AS3 will come true at a slower pace. 

This will make it much easier to develop an IDE for JS. 

ɤʄʝʜʔʊʅʌəʇɲɩʟʗɮɳɳʬɭʖ said...

it just does not scale to enterprise level applications. Google developed the Closure compiler for that, and they add lots of language features (type safety, constructors, ...) by using annotations in the jsdoc. Obviously it works for them (google docs, gmail, g+, ...), but it's still a hack.

Emrah Atılkan said...

i think it will be great, Google makes bests. And as a javascript coder, it has not a standard, different on the browsers and it is slow. And i think Google Wave and Go are great products, just people dont use it, because they dont need. But developers need better, faster environments. 
Apple's softwares are all slow, just maked up and exaggerated products, microsoft is known by everbody, But Google products are future.

ikarus said...

Of the years I've done Javascript it seems the people evolving it act like it's evolving faster than it really is. All the new specs just add new features. It's the base that needs to be fixed. I love to prototype based OO, but it's difficult to use right. There's the global variables and, not to mention how confusing "==" and "===" is to new scripters. For years I programmed using "==" without knowing the right way. Fix the base, break compatibility, it just needs to be fixed. Until js gets it's ugly parts fixed I'm looking forward to this.

Ralph Haygood said...

I share the reservations voiced by many here about a would-be standard owned by a particular company (Google's protestations of openness notwithstanding). Also, Dart would interest me and, I suspect, many other programmers much more if we could build hybrid Dart/JavaScript applications, a possibility I haven't seen mentioned yet (though I haven't read much about Dart yet). Obviously, that would undercut toolability and presumably performance too, but asking people to give up JavaScript entirely and write big, complex applications in Dart alone is asking too much up front. Among other things, few web developers are likely to be willing to abandon their favorite user-interface libraries (Ext, Scriptaculous, etc.), which save them large amounts of effort.

Ralph Haygood said...

To clarify, I realize that Dart is translatable into JavaScript, but it isn't clear to me yet how easy it is or will be to write hybrid applications.

Axel Rauschmayer said...

Good question. It will depend on Google’s final decision on how to position Dart: as a JavaScript replacement or as a Java/GWT replacement. It’s currently all a bit vague and I’m surprised that we didn’t get a definitive answer today as to whether Dart will be integrated with Chrome or not.

More information: http://www.2ality.com/2011/10/dart-launch.html

Woz said...

I like the concept of prototypal inheritance in JS but it is all wrapped up in a turd that for years people have tried to clean up but instead they have just rolled in glitter.
The following sums up everything that is wrong with JSvar that = this;

And that, or should that be this, is before you get to the lack of decent scope rules and all the other pitfalls that bog down the development of anything of true size.

Prashant said...

I know its sounds sad but I think Google is going the Microsoft  way..

Axel Rauschmayer said...

For parts of the company, it certainly feels that way. Interestingly, Microsoft is increasingly doing “googly” things. For example, it has thrown its full weight behind JavaScript for Windows 8.

Aeneasdardanus said...

IDE's are for retards.

Axel Rauschmayer said...

Not a very helpful comment. Either argue your point or don’t comment.

Web Analytics