Dart, a language from Google to replace JavaScript and PHP

Dart runs in the browser and on the server, it provides the features of a very classical application programming language.

The new language from Google is intended to be more structured like Pascal was in respect to Basic. Available at dartlang.org, it offers an alternative to JavaScript in the browser but also on the server. It may also be compiled to JavaScript.
It implements concurrency in the form of communicating actors with their own environment and has true classes.

Dart programming language and web apps

Faced with fundamental design problems in JavaScript that it see not solved by incremental improvements, Google opted for a radical solution: completely replaces the language with another, with a syntax that is between that of JavaScript and Java. But JavaScript is a language that is interesting in its overall design, it is the details that are weak and Dart unfortunately change this innovative design to return to the classics.

Another solution would have beem better: to allow browsers to use any programming language. Or use a bytecode for which we could create different languages ​​in frontend (a role fulfilled actually by Asm.js).

Google promises that programming will become interactive thanks to tools, you will edit and run a program directly, and change the code according to the results. For a Web application, it will be a big advantage.
Programs may be evolving. You can begin with a simple script with dynamic variables, which can be transformed into software when you add typed variables and classes.
Another advantage is the ability to use the same language on the server and the browser, which simplifies programming, but we can already do that with Node.js (and the Google's V8 compiler).

Dart will be in competition with Harmony, the final version of JavaScript in development which will also include classes. 

A modern version of C to replace JavaScript

The syntax of Dart is more than classic, it's actually that of languages of the 70. The Scriptol language dating from 2001 was already more innovative.

A Dart program can be executed by a virtual machine or compiled into JavaScript and thus produce a code usable by all browsers.
On Chrome, a plugin allows to use the virtual machine.

We see that there is really nothing innovative in all this, but isolates, nothing but a kind of upgrading for JavaScript - a language created in the 90 - to the norms of yesterday, or a modern version of C - created in 1972. Even if the language offers powerful features, it really lacks imagination.

Examples of code

Hello:

main()
{
  print("Hello World!");
}

Function:

String catstr(String str)
{
  String x = "Message : $str";
  return x;
}
print(catstr("Hello"));

We can concatenate two variables a and b with: String x = "$a$b";

Objects:

Class Vehicle
{
  num fuel;
  Vehicule(num this.vitesse, num this.passengers);
  num distance() // the type is optional.
  {
    print fuel / this.passengers;
  }
}
Class Car extends Vehicle
{
   ...
}

Dart will it be supported on all browsers?

It is unlikely that Microsoft or Apple adopt this language before a long time, so the virtual machine is confined to Chrome. In fact Microsoft chose a different option: to develop TypeScript, a language that is compiled to JavaScript.
However ECMA has a project to make it a future standard.

There is a version of Chrome which integrates a Dart virtual machine called Dartium. However, the community that develops Webkit refused its implementation on the ground that is not part of the standard Web. It's the same thing on the side of Mozilla where one believes that a future version of JavaScript could add the same improvements that brings Dart, mainly the class model and typed variables (without losing the advantages of JavaScript). We do not mean that Microsoft has issued a negative opinion on the subject, or that Apple is far from wanting to support Google.

It seems that in the near future, Dart will only work on Chrome and since it runs on Android, provides an alternative to native programming. But one can imagine a Dart plugin for other browser, such as Google Frame that enables support for HTML 5 on older version of Internet Explorer.

Going further...

Tools

Documents and resources

See also...