The tool explains how various basic elements are written in Dart, compared to JavaScript

Jan 31, 2012 12:21 GMT  ·  By

A couple of Google engineers set about creating a JavaScript to Dart "dictionary." The idea is to enable JavaScript developers to see how code written in their preferred language would translate into Dart, what the differences and similarities are.

The app lists some of the common use cases and language constructs. It also enables users to search JavaScript code "translations."

"It took approximately 2000 years for the original Rosetta Stone to be discovered, which helped translate the Egyptian Hieroglyphs. We couldn’t wait that long to bridge the Dart and JavaScript worlds, so today we are releasing the JavaScript to Dart Synonym app," Google's Aaron Wheeler and Marcin Wichary wrote.

"Like most web developers, we are familiar, comfortable, and productive with JavaScript. We were curious about Dart, and thanks to a recent Dart hackathon, we had the chance to play with the language and libraries," they said.

"The problem was, as JavaScript developers, we didn’t know how to map common JavaScript idioms to Dart. Hence the idea for this synonym app was born," the two explained.

The app itself is appropriately written in Dart. The app is now available over at dartlang.org, but it only works in a Chromium build, dubbed Dartium, that comes with a Dart virtual machine built in.

So far, the developers have been focusing on the essentials, variables, arrays, functions, classes, DOM manipulation and others.

The app should give you an idea of the differences between the two languages, but it should also provide some clues on the thinking behind Dart and why some of the features have been built the way they have.

Dart has been rather controversial. The language, designed to replace JavaScript, but developed in the dark at Google, has many critics, not necessarily over its technical validity, but over the way it was developed and is now promoted.