Google Dart gets its own version of the Angular 2 framework

Critics respond that separate Angular 2 versions -- one for Dart and one for TypeScript/JavaScript -- might actually discourage Dart adoption

Google Dart gets its own version of the Angular 2 framework

Google's Dart language will get its very own version of the company's Angular 2 framework to better leverage Dart's own capabilities. But the plan has raised concern that it could actually hurt the fledgling language.

The Angular code base will be split into two flavors: a Dart version -- referred to as AngularDart or Angular 2 Dart -- and a TypeScript/JavaScript version, Google said this week.

This division provides a version of Angular 2 that feels more like idiomatic Dart, is faster, and will leverage Dart features that could not work with the TypeScript version, Google's Filip Hracek said. Angular Dart source code will be "cleaner" for developers, and the Dart and Angular teams pledged that issues would be closed quicker and that documentation can be written with a Dart focus.

But a person commenting on a Dart blog post questioned how good the move actually was for Dart.

"Is this really good news? I think that the only way Dart will survive is to play well with JS," said commenter Rasmus Ersmarker. "To be able to write Dart libraries and Angular components in Dart that could be used from JS. This seems to be a step away from this and makes Dart more isolated from the JS world."

Google's Kaspar Lund responded that Dart thrives because it's used to build "truly critical" apps. "Making Angular 2 for Dart faster and better strengthens the case for choosing the Dart and Angular combination for such apps even further. That's pretty good news in my book even though I do understand your point and concerns."

Proponents emphasized the move would be easier to make contributions than under the previous setup, in which the multiple language flavors of Angular 2 were written as TypeScript source and compiled to both JavaScript and Dart. While a single-source language approach worked in theory, it made it much harder for new contributors to add to Angular, the teams explained. "Even simple changes could quickly become complicated by cross-language compatibility concerns, and many changes could only be made by someone who understood the entire compilation process and both language targets," they said.

Both versions will share a template syntax and, where appropriate, an API. "If you're a TypeScript or JavaScript developer, you'll also benefit from cleaner JavaScript APIs and performance gains as we simplify the TypeScript codebase to remove the need for compilation to Dart," the teams said.

Officially unveiled nearly five years ago, Dart has gained some traction with developers but has had limited success compared to JavaScript, the language that Dart was intended to eventually replace. Google scrapped this lofty goal last year and instead focused on compiling Dart to JavaScript. Specifically, the company dropped plans to integrate the Dart VM into its Chrome browser.

Featuring dependency injection and HTML-driven directives, Angular has gained legions of followers. Angular 2, which constitutes a rewrite of the framework, is available as a release candidate. The upgrade has been slated to allow use of multiple renderers, be decoupled from the DOM, and support "lazy loading," in which only JavaScript modules needed for a particular view are loaded.

Google this week also revealed plans to release a library of Material Design components for Angular 2 Dart. Material Design, which provides advanced visual capabilities in applications, was introduced for the Android platform in June 2014.

Copyright © 2016 IDG Communications, Inc.