This article is more than 1 year old
Google throws new version of Dart at the desktop, will be hoping it sticks with app devs
Reformed JavaScript killer now useful on the command line
Google software engineers have delivered Dart 2.6, an update to the open source programming language that provides the ability to create self-contained, native executables for the major desktop operating systems.
That capability comes from an extension to the Dart compiler set called dart2native
, which makes it possible to turn Dart files into self-contained executables holding ahead-of-time (AOT) compiled machine code. In other words, these executables will run on machines that don't have the Dart SDK installed.
"With dart2native
, you can create tools for the command line on macOS, Windows, or Linux using Dart," said Michael Thomsen, a Google product manager, in a blog post.
Thomsen notes that Dart has supported AOT compilation to x86 and ARM executables for several years through Dart Native, but this capability has only been exposed through the Flutter SDK, Google's framework for creating native Android and iOS mobile applications using Dart.
Dart 2.6 also includes an improved version of dart:ffi
, which provides C interoperability, and a new language feature called extension methods.
Introduced in 2011 (and originally called Dash), Dart initially alienated web developers because the Google engineers behind it believed JavaScript had "fundamental flaws that cannot be fixed merely by evolving the language." That’s how a message by a Google employee sent to an internal mailing list framed the issue in 2010. Google computer scientist Mark Miller, designer of the E and Caja programming languages, was trying to forward it to another internal list but inadvertently sent it to an external one. (Previously, The Register erroneously said Miller wrote it but he told us he merely forwarded it and within the company he objected to it loudly.)
Brendan Eich, CTO of Mozilla at the time, dismissed the assertion about JavaScript’s failings and expressed concern that Google’s go-it-alone approach would hinder the advancement of web technology.
In a post to Hacker News in 2011, he wrote, "The leaked Google doc's assertion that this is impossible and that a 'clean break' is required to make significant improvements is nonsense, a thin rationale for going it alone rather than cooperating fully."
His concern about Dart was that Google would divide the web community and fragment web content. In order for Dart to replace JavaScript, it would first need support in browsers, in the form of the Dart VM. Eich said that would never happen.
"A Dart to JS compiler will never be 'decent' compared to having the Dart VM in the browser," Eich wrote. "Yet I guarantee you that Apple and Microsoft (and Opera and Mozilla, but the first two are enough) will never embed the Dart VM."
Eich's prediction proved prophetic. In 2015, Google decided not to build the Dart VM into its Chrome browser, effectively conceding that Dart won't replace JavaScript in the current web ecosystem. Instead, Dart code gets converted into JavaScript to run on the browser and gets converted into AOT-compiled Dart code for app store distribution using the Flutter framework or for use as a command-line executable.
Python overtakes Java to become second-most popular language on GitHub after JavaScript
READ MOREIf developers were initially skeptical about Dart, they appear to be warming to it, thanks perhaps to Google's persistent promotion of Flutter and its promise that Flutter apps will run on the company's nascent Fuchsia operating system.
In GitHub's State of the Octoverse report, covering October 1, 2018 through September 30, 2019, the Microsoft-owned code hosting biz observed a surge in Dart interest. The language saw a 532 per cent increase during the report period, more than any other programming language and twice as much growth as the second-place rising star, Rust.
JavaScript remained the top language, followed by Python (which knocked Java down a peg). Eich, the inventor of JavaScript, is known among other things for saying, "Always bet on JavaScript."
Dart still has a ways to go before it enters anyone's list of top ten programming languages – consultancy Redmonk ranked it #27 in July – but at least now its potential uses have moved beyond internal Google ad tech. ®