This article is more than 1 year old

Google's Dart on target to replace JavaScript? That'll be the day

Ecma standards effort won't topple web's lingua franca

Analysis Last week, Google announced that the international standards body Ecma had formed a new technical committee devoted to Dart, the Chocolate Factory's homegrown web browser scripting language. But don't expect Dart to replace JavaScript as the web's lingua franca anytime soon.

"The new standardization process is an important step towards a future where Dart runs natively in web browsers," Google product manager Anders Sandholm wrote in a blog post on Thursday.

Maybe. Google already offers a browser with a built-in Dart virtual machine in the form of Dartium, the Chrome variant that comes with the Dart software development kit (SDK). It could very easily roll that code into the shipping version of Chrome. But getting other browser vendors to bundle Dart VMs with their own products will be a tall order, standard or no standard.

Make no mistake; JavaScript as it exists today has its share of issues. The language was designed in a hurry and it's packed full of insidious features that make it easy for programmers to do the wrong thing, especially when dealing with large projects.

Its design also makes it difficult to get good performance out of it. Browser vendors are constantly touting the performance gains of their latest JavaScript VMs, but in truth, these increases are generally small and the rate of progress is slowing. We may soon reach the limit of how much JavaScript code can be optimized.

How do you solve a problem like JavaScript?

Switching to a different language for client-side web development could help solve both of these problems. Google says its native Dart VM already outperforms its own JavaScript VM in some circumstances. Yet to assume that Dart will become JavaScript's successor just because it has Google's backing would be a mistake.

For one thing, Dart isn't the only solution that has been proposed. Language guru Anders Hejlsberg and a team of engineers at Microsoft have developed TypeScript as another way of attacking many of the same problems that Dart aims to solve, and these days many other languages can be compiled into JavaScript and run in a browser.

Even current Mozilla CTO Brendon Eich, JavaScript's creator, has lately backed Asm.js, a highly optimizable subset of JavaScript that's designed to be output from compilers. Using Asm.js and the Emscripten compiler, high-performance browser applications can even be written in C, for example.

What's more, even if Dart becomes a full-fledged Ecma standard, that's no guarantee that it will gain traction. JavaScript itself is based on an Ecma standard called EcmaScript, but it was submitted for standardization because it was a widely used language, not the other way around.

In the early 2000s, Microsoft made great hay about its C# language being accepted as both an Ecma and an ISO standard, but other than the Mono project, most of the industry greeted the news with a shrug. These days, the current version of the language is C# 5.0, but neither of the standards has been updated since version 2.0 in 2006. So much for that, then.

But perhaps the biggest impediment to Dart gaining widespread adoption is that so far it has been developed almost entirely within Google to address Google's own needs, and Google remains its most prominent backer, if not its only significant backer. Simply put, Dart is a Google product.

The web: We do it together or not at all

That doesn't bode well for Dart on the wider web, based on past examples. Previously, the Chocolate Factory has offered up the Pepper API, billed as a superior replacement for the old Netscape browser plugin API. But the other browser vendors have mostly rejected Pepper, with Eich saying Mozilla wasn't interested in the tech until it "achieves consensus" within the industry.

Standardization might be one way for Dart to achieve consensus where Pepper has not. But that implies that other major players in the industry will participate in the standardization process, and so far there's not much evidence that they plan to.

Just like how none of the other browser vendors got on board with Microsoft's web technologies like JScript and ActiveX in the 1990s, the wider web industry is unlikely to back a Google brainchild today. For better or worse, consensus is the way things get done on the web, and that's truer today than it has ever been.

That's not to say Dart is a dead end. It still has plenty of potential as a language that compiles into JavaScript, and Google is already using it for a few major projects internally.

Google could even go ahead and release a version of Chrome that includes a native Dart VM – even if the other browser vendors don't follow suit – and web developers could serve raw Dart code to Chrome users while sending Dart compiled into JavaScript to everyone else.

But that's what Dart seems destined to remain: an option, not an evolution. Like it or not, the web already has a client-side language, and it is JavaScript. There will continue to be many tools and ways of developing applications that run on JavaScript VMs, including writing Dart code that compiles to JavaScript. But even once Dart is standardized, to expect it to replace JavaScript altogether seems like wishful thinking – mainly because it's only Google that really wishes it. ®

More about

TIP US OFF

Send us news


Other stories you might like