Google Make Me Smarter

Maintained by Google BOX & Jaava.In













DART - A New Era Begin

Dart is an open-source Web programming language developed by Google. It was unveiled at the GOTO conference in Aarhus, 2011 October 10–12. The goal of Dart is "ultimately to replace JavaScript as the lingua franca of web development on the open web platform", but Dart is currently not natively supported in any mainstream browser. Dart is intended to address JavaScript's problems (which Google's engineers felt could not be solved by evolving the language) while offering better performance, the ability "to be more easily tooled for large-scale projects" and better security features. 

Google works on Dart to help it build more complex, full-featured client-side Web applications. Dart is a class-based, single inheritance, object-oriented language with C-style syntax. It supports interfaces, abstract classes, reified generics, and optional typing. Static type annotations do not affect the runtime semantics of the code. Instead, the type annotations can provide documentation for tools like static checkers and dynamic run time checks. The project was founded by Lars Bak and Kasper Lund.

Usage


There are three primary ways to run Dart code:


Compiled as Java Scriptv:

 When running Dart code in a web browser, the primary intended mechanism is to pre-compile the Dart code into JavaScript using the dart2js compiler. Compiled as JavaScript, Dart code is compatible with all major browsers with no specific browser adoption of Dart being required. Through optimization of the compiled JavaScript output to avoid expensive checks and operations, code written in Dart can, in some cases, run faster than equivalent code hand-written using JavaScript idioms.

In The Dartium Browser:

 The Dart SDK ships with a version of the Chromium web browser modified to include a Dart virtual machine. This browser can run Dart code directly without compilation to JavaScript. It is currently not intended for general-purpose use, but rather as a development tool for Dart applications. When embedding Dart code into web apps, the current recommended procedure is to load a bootstrap JavaScript file, "dart.js", which will detect the presence or absence of the Dart VM and load the corresponding Dart or compiled JavaScript code, respectively, therefore guaranteeing browser compatibility with or without the custom Dart VM.


Stand-Alone: 

The Dart SDK also ships with a stand-alone Dart VM, allowing dart code to run in a command-line environment. As the language tools included in the Dart SDK are written primarily in Dart, the stand-alone Dart VM is a critical part of the SDK. These tools include not only the dart2js compiler, but also a package management suite called pub. Dart ships with a complete standard library allowing users to write fully functional system apps, such as custom web servers.


Runtime modes

Dart programs run in one of two modes. In "checked mode", which is not the default mode and must be turned on, dynamic type assertions are enabled. These type assertions can turn on if static types are provided in the code, and can catch some errors when types do not match. For example, if a method is annotated to return a String, but instead returns an integer, the dynamic type assertion will catch this and throw an exception. Running in "checked mode" is recommended for development and testing. Dart programs run by default in "production mode", which runs with all dynamic type assertions turned off. This is the default mode because it currently is the fastest way to run a Dart program.


Compiler to JavaScript


dartc was the first compiler that emitted JavaScript from Dart code. dartc has been deprecated. Frog was the second instance of a Dart-to-JavaScript compiler, this time written in Dart. Frog never implemented the full semantics of the language, though, and a new compiler called dart2js was created. Also written in Dart, dart2js is the current Dart-to- JavaScript compiler and is intended to implement the full Dart language specification and semantics.
Browser Adoption
Dart compiles to JavaScript, allowing Dart applications to run in web browsers. However, there is a special version of Chromium that embeds the Dart virtual machine.  This enables this browser to run Dart programs without first being compiled to JavaScript. With the M1 release, the generated JavaScript reaches about 78% of the performance of hand-written JavaScript while native Dart code runs about 21% faster than similar code in V8.


To visit official website CLICK HERE

Unknown

Editor is official technical writer at this blog. Editor also helps us managing our multinational community 'Google Make Me Smarter'. To know more about our team visit Hall of FAME section on this website.

Google Make Me Smarter |. We're Glad To Announce That Our Blog Is Powered By Google's Blogger


Designed by Templateify , Your Link Here