📜 ⬆️ ⬇️

Official Google Dart Language Presentation

Today, Google has officially unveiled a new structured web programming language Dart , which will allow you to create fast and high-performance web applications. For all its simplicity for writing small scripts, using Dart, you can create complex modular web applications, use libraries, debuggers, code editors, and other tools.

The official site presents a technical overview of the language ( translated into Russian from azproduction ), specifications (PDF), a list of libraries .

As explained in the company's internal correspondence, Dart is positioned as a replacement / alternative to Javascript suffering from "fundamental" flaws that cannot be fixed by evolutionary development.

Key benefits of dart

Dart is still in early development. The creator of the language is the famous programmer Lars Bak (Lars Bak), who is assisted by a group of developers in the Danish office. Additional tools are provided by the Bruce Johnson team in Atlanta, and the Web Inspector support for Dart and Harmony is handled by Pavel Feldman (Pavel Feldman) with developers from St. Petersburg.
')

Examples

Definition of interface, class and subclass.

interface Shape { num perimeter(); } class Rectangle implements Shape { final num height, width; Rectangle(num this.height, num this.width); // Compact constructor syntax. num perimeter() => 2*height + 2*width; // Short function syntax. } class Square extends Rectangle { Square(num size) : super(size, size); } 

Here's how the same Point class can be entered in simple code, with parameters x and y , without additional types.

 class Point { var x, y; Point(this.x, this.y); scale(factor) => new Point(x*factor, y*factor); distance() => Math.sqrt(x*x + y*y); } main() { var a = new Point(2,3).scale(10); print(a.distance()); } 

And the same code with the use of the additional type num , which is necessary with the increasing complexity of the web application.

 class Point { num x, y; Point(num this.x, num this.y); Point scale(num factor) => new Point(x*factor, y*factor); num distance() => Math.sqrt(x*x + y*y); } void main() { Point a = new Point(2,3).scale(10); print(a.distance()); } 


Dart can be used in different ways:


Recall that the Dart is designed with three main objectives in mind:


Dart should also provide maximum security where this task does not conflict with the three main ones.

It is assumed that Dart support will be built into all browsers as the main native client language (instead of Javascript), it will be used on front-end servers, as well as in cross-compilers.

In parallel with the “revolutionary” version, which is Dart, Google will also promote another solution to the problem - the Harmony project, within which it will correct those disadvantages of Javacript that are possible.

Source: https://habr.com/ru/post/130065/


All Articles