Audio of Dart Programming Language—Wikipedia 2022

Dart (programming language)

From Wikipedia, the free encyclopedia

Dart is a programming language designed for client development, such as for the web and mobile apps. It is developed by Google and can also be used to build server and desktop applications.

It is an object-oriented, class-based, garbage-collected language with C-style syntax.[10] It can compile to either native code or JavaScript, and supports interfaces, mix-ins, abstract classes, reified generics and type inference.

Content outline is as listed,

1 History

2 Usage

3 Isolates

4 Snapshots

5 Native mobile apps

6 Compiling to JavaScript

7 Editors

7.1 Chrome Dev Editor

7.2 DartPad

8 S-I-M-D

9 Example

10 Influences from other languages

Sections 11,12,13 and 14, pertain to See also, References, Bibliography, andExternal links sections

History

Dart was unveiled at the GOTO conference in Aarhus, Denmark, October 10–12, 2011. The project was founded by Lars Bak and Kasper Lund. Dart 1.0 was released on November 14, 2013.

Dart initially had a mixed reception and the Dart initiative has been criticized by some for fragmenting the web, due to the original plans to include a Dart VM in Chrome. Those plans were dropped in 2015 with the 1.9 release of Dart to focus instead on compiling Dart to JavaScript.

Dart 2.0 was released in August 2018, with language changes including a sound type system.

Dart 2.6 introduced a new extension, dart2native, which extends native compilation to the Linux, macOS, and Windows desktop platforms. Earlier developers could create new tools using only Android or iOS devices. With this extension it also becomes possible to compose a program into self-contained executables. According to company representatives, it’s no longer necessary to have the Dart SDK installed, as the self-contained executables can now start running in a few seconds. The new extension is also integrated with the Flutter toolkit, making it possible to use the compiler on small services (for example, backend support).

Standardization

E-c-m-a International has formed technical committee TC52 to work on standardizing Dart, and inasmuch as Dart can be compiled to standard JavaScript, it works effectively in any modern browser. E-I approved the first version of the Dart language specification in July 2014 at its 107th General Assembly, and a second edition in December 2014. The latest specification is available via a link to the Dart dot Dev website.

Usage

There are four ways to run Dart code:

Web

To run in mainstream web browsers, Dart relies on a source-to-source compiler to JavaScript. According to the project site, Dart was "designed to be easy to write development tools for, well-suited to modern app development, and capable of high-performance implementations." In a web browser, the code is precompiled into JavaScript using the dart-2-j-s compiler, making it compatible with all major browsers with no need for browsers to adopt it. By optimizing the compiled JavaScript output to avoid expensive checks and operations, code written in Dart can, in some cases, run faster than equivalent code handwritten in JavaScript idioms.

Stand-alone

The Dart software development kit (S-D-K) ships with a stand-alone Dart V-M, allowing Dart code to run in a command-line interface environment. As the language tools included in the S-D-K are written mostly in Dart, the Dart V-M is a critical part of it. These tools include the dart-2-j-s compiler and a package manager called pub. Dart ships with a complete standard library allowing users to write fully working system apps, such as custom web servers.

Ahead-of-time compiled

Dart code can be A-O-T-compiled into machine code (native instruction sets). Apps built with Flutter, a mobile app S-D-K built with Dart, are deployed to app stores as A-O-T-compiled Dart code.

Native

Dart 2.6 includes the dart2native compiler to compile to self-contained, native executable code. Before Dart 2.6, this feature exposed this capability only on iOS and Android mobile devices via Flutter.

Isolates

To achieve concurrency, Dart uses isolates, independent workers that do not share memory, but use message passing, similarly to Erlang processes (also see actor model). Every Dart program uses at least one isolate, which is the main isolate. Since Dart 2, the Dart web platform no longer supports isolates, and suggests developers use Web Workers instead.

Snapshots

Snapshots, a core part of the Dart V-M, are files that store objects and other runtime data.

Script snapshots

Dart programs can be compiled into snapshot files containing all of the program code and dependencies pre-parsed and ready to execute, allowing fast startups.

Full snapshots

The Dart core libraries can be compiled into a snapshot file that allows fast loading of the libraries. Most standard distributions of the main Dart VM have a prebuilt snapshot for the core libraries that is loaded at runtime.

Object snapshots

Dart is a very asynchronous language, using isolates for concurrency. Since these are workers that pass messages, it needs a way to serialize messages. This is done using a snapshot, which is generated from a given object, then transferred to another isolate for deserializing.

Native mobile apps

Google has introduced Flutter for native mobile app development on Android, iOS and Windows. Flutter is a mobile app S-D-K, complete with framework, widgets, and tools, that gives developers a way to build and deploy mobile apps, written in Dart. Flutter works with Firebase and other mobile app S-D-Ks, and is open source.

Compiling to JavaScript

The Dart SDK contains two Dart-to-JavaScript compilers. During development, dart-dev-c supports quick refresh cycles. For the final version of an app, dart-2-j-s produces deployable JavaScript.

The first compiler to generate JavaScript from Dart code was dart-c, but it was deprecated. The second Dart-to-JavaScript compiler was Frog. It was written in Dart, but never implemented the full semantics of the language. The third Dart-to-JavaScript compiler was dart-2-j-s. An evolution of earlier compilers, dart-2-j-s is written in Dart and intended to implement the full Dart language specification and semantics.

On March 28, 2013, the Dart team posted an update on their blog addressing Dart code compiled to JavaScript with the dart-2-j-s compiler, stating that it now runs faster than handwritten JavaScript on Chrome's V8 JavaScript engine for the DeltaBlue benchmark.

Editors

On November 18, 2011, Google released Dart Editor, an open-source program based on Eclipse components, for macOS, Windows, and Linux-based operating systems. The editor supports syntax highlighting, code completion, JavaScript compiling, running web and server Dart applications, and debugging.

On August 13, 2012, Google announced the release of an Eclipse plugin for Dart development.

On April 18, 2015, Google announced that the Dart Editor would be retired in favor of the JetBrains integrated development environment, which is now the recommended IDE for the language. The Dart plugin is available for IntelliJ IDEA, PyCharm, PhpStorm and WebStorm. This plugin supports many features such as syntax highlighting, code completion, analysis, refactoring, debugging, and more. Other plugins are available for editors like Sublime Text, Atom, Emacs, Vim and Visual Studio Code.

Chrome Dev Editor

In 2013, the Chromium team began work on an open source, Chrome App-based development environment with a reusable library of GUI widgets, codenamed Spark. The project was later renamed as Chrome Dev Editor. It was built in Dart, and contained Spark which is powered by Polymer.

In June 2015, Google transferred the CDE project to GitHub as a free software project and ceased active investment in CDE. As of April 2019 Chrome Dev Editor is no longer in active development.

DartPad

The Dart team created DartPad at the start of 2015, to provide an easier way to start using Dart. It is a fully online editor from which users can experiment with Dart application programming interfaces (APIs), and run Dart code. It provides syntax highlighting, code analysis, code completion, documentation, and HTML and CSS editing.

S-I-M-D

In 2013, John McCutchan announced that he had created a performant interface to single instruction, multiple data, S-I-M-D, instruction sets for Dart.

The interface consists of two types:

Float32×4, 4× single precision floating point values

Uint32×4, 4× 32-bit unsigned integer values

Instances of these types are immutable and in optimized code are mapped directly to SIMD registers. Operations expressed in Dart typically are compiled into one instruction with no overhead. This is similar to C and C++ intrinsics. Benchmarks for 4×4 matrix multiplication, 3D vertex transformation, and Mandelbrot set visualization show near 400% speedup compared to scalar code written in Dart.

Example

A Hello, World! example:

void main() open curly bracket

print('Hello, World!');

Close curly bracket

A simple class:

// Import the math library to get access to the square root function.

// Imported with `math` as name, so accesses need to use `math.` as prefix.

import 'dart:math' as math;

// Create a class for Point.

class Point open Curly bracket

// Final variables cannot be changed once they are assigned.

// Declare two instance variables.

final num x, y;

// A constructor, with syntactic sugar for setting instance variables.

// The constructor has two mandatory parameters.

Point(this.x, this.y);

// A named constructor with an initializer list.

Point.origin()

: x = 0,

y = 0;

// A method.

num distanceTo(Point other) open curly bracket

var dx = x - other.x;

var dy = y - other.y;

return math.square root(d-x * d-x + d-y * d-y);

Close curly bracket

// Example of a "getter".

// Acts the same as a final variable, but is computed on each access.

num get magnitude => math dot s-q-r-t(x * x + y * y);

// Example of operator overloading

Point operator +(Point other) => Point(x + other dot x, y + other dot y);

// When you instantiate a class such as Point in Dart 2+, new is

// an optional word

Close curly bracket

// All Dart programs start with main().

void main() open curly bracket

// Instantiate point objects.

var p1 = Point(10, 10);

print(p1.magnitude);

var p2 = Point.origin();

var distance = p1.distanceTo(p2);

print(distance);

Close curly bracket

Influences from other languages

Dart is a descendant of the ALGOL language family, alongside C, Java, C#, JavaScript, and others.

The method cascade syntax, which provides a syntactic shortcut for invoking several methods one after another on the same object, is adopted from Smalltalk.

Dart's mix-ins were influenced by Strongtalk and Ruby.

Dart makes use of isolates as a concurrency and security unit when structuring applications. The Isolate concept builds upon the Actor model, which is most famously implemented in Erlang.

The Mirror API for performing controlled and secure reflection was first proposed in a paper by Gilad Bracha (who was a member of the Dart team) and David Ungar and originally implemented in Self.

This is the end of the article.

For See also, References, Bibliography, External links and more information visit Wikipedia.com

This article was last edited on 4 June 2022.

This sound file and all text in the article are licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License, available at creative commons dot org slash licenses slash by hyphen S A slash three point zero.

En.wikipedia.org. 2022. Dart (programming language) - Wikipedia. [online] Available at: <https://en.wikipedia.org/wiki/Dart_(programming_language)> [Accessed 16 June 2022].

Previous
Previous

rEVIeW OF Evaluation of mRNA-1273 Covid-19 Vaccine in Children 6 to 11 Years of Age—cREECH 2022

Next
Next

Visas In Bangladesh—Wikipedia 2022