Dart is an open-source, scalable programming language, with robust libraries and runtimes, for building web, server, and mobile apps.

Thursday, May 30, 2013

Dart project co-founders answer your questions

The Dart team received a lot of great feedback from the community in response to our various Dart presentations at Google I/O. We asked Lars Bak and Kasper Lund, Dart project co-founders, to help answer your questions. Here's what they shared. Enjoy!

Q01: Are there any plans for to use Dart as an alternative or replacement to Java for Android app development (native APK apps)? James Wendel, United States

A01: The current focus for Dart is web applications. Your best bet is to talk to the Android team about this.

Q02: In some benchmarks the DartVM is now outperforming the JVM. Do you you think it will be possible for the DartVM to outperform the JVM for most code? Are there specific areas where the JVM's design will allow it to perform better than the DartVM? Greg, Wellingtron

A02: For programs like numeric computations Java will always have a performance advantage over the Dart VM. The reason is that Dart code is dynamically typed whereas Java has built-in basic types like byte, int, and double. However, for object oriented application code we see no reason for not matching or exceeding the speed of JVMs. We will continue to push performance of the Dart VM since performance is a key driver for web application innovation.

Q03: Few years back GWT was heavily promoted by Google. Now Google is promoting Dart for the future web development. How could I convince my company towards those technology for the longer run? and what are benefits would I get if I choose? Thamizharasu, Chennai

A03: Dart is on track to get into Google Chrome, is used by critical internal projects, and has a growing community. Dart has commitment from Chrome, has a large and experienced team working on it, and the team is investigating how to place Dart into a standards organization.

Q04: In which ways the requirement of Javascript as a compilation target for compatibility affected Dart? What would you make different if this requirement wasn't there? mdakin, Zurich

A04: To ensure compatibility with all modern browsers, we only added language featured to Dart that could be translated into efficient JavaScript. One useful feature we abandoned was "non-local returns" that requires unwinding of stack activations. In JavaScript you can implement a non-local return by throwing an exception. However, this turns out to be extremely slow on most JavaScript engines.

Q05: How much faster than Javascript can Dart get? Nik Graf, San Francisco

A05: The Dart team's goal is be at least 2X faster than V8. See dartlang.org/performance for some benchmarks and results.

Q06: Can you share some details on language support for asynchronous programming? It's a huge pain in JavaScript and Dart can make a real difference here. Ladislav Thon

A06: We expect to take another look at what language features might help with async programming, but not until after 1.0 launch.

Q07: Any hints about possible future language features that could be added after 1.0 is released? Greg, Wellingtron

A07: We expect to implement enums. We also expect to explore features for async.

Q08: Today Google introduced new Android Studio. Is there a plan for releasing something similar for Dart? Valeriy, Ukraine

Q09: Can you outline the distinctions between Dart and GO on the server side? Will Dart in the future compete with GO on the server side? thien bui, Berlin

A09: There are many distinctions between Go and Dart. Go is a structurally typed language, requires a compiler, has goroutines for concurrency, and is designed for lower-level systems programming. Dart is nominally types, does not require a compiler, uses isolates for concurrency, and is designed for modern web apps (that run on client and server). Dart has been designed to compile to JavaScript, Go has been designed to compile to efficient server-side code. Go is more mature, and has more tools than Dart right now.

Q10: Are there plans to extend SIMD support by adding new features like AVX and add GPU programming support to language and VM? mdakin, Zurich

A10: There are plans to take advantage of the new AVX instruction set. One example, would be adding Float32x8 type which fits inside the new 256-bit wide registers. Another example would be to use the new gather and permute instructions. There are no plans to add GPU programming support to Dart at this time.

Q11: EcmaScript 6 is taking shape - offers classes, modules, block scoped vars (let/const), iterators and other good stuff. asm.js offers performance. Why use Dart - especially if the DartVM is not built into Chrome(OS)/Blink and Android. kc, UK

A11: We're excited to see JavaScript continue to evolve. Dart is a more ambitious effort to take a fresh look at web programming, and thus doesn't need to deal with all the backwards-compatibility issues facing ES6. For example, Dart has many new features like string interpolation, mixins, isolates, lexical this, ints and doubles, named constructors, named optional parameters with default values, real libraries, tree shaking, no undefined (only null), simple truthy/falsey values (only true is true), and of course optional type annotations. Dart is a more toolable, statically analyzable language and thus it's easier to be more correct about refactoring, warnings and errors, code navigation, tree shaking, and more. People use Dart because they like the performance and productivity. (Note: asm.js only accelerates a narrow type of programming, which is dealing with numbers. The Dart VM optimizes programs you'd author by hand.)

Q12: What are the advantages/disadvantages of a sourcecode VM, such as Dart, versus a bytecode VM, such as the JVM? Greg, Wellingtron

A12: Productivity comes to mind. With a source code VM, you don't need to first compile code before running the app. Thus, the iteration cycles are much faster. Just edit and reload! This is important for web developers who want to iterate quickly. Note that the Dart VM internally generates machine code from the source code, via its optimizing compiler.

Also, a real disadvantage of a bytecode VM is the VM needs to verify the integrity of the bytecodes before they can be executed. This adds complexity and opens up for security problems.

Q13: For now Google is the only one embracing Dart on Chrome. I don't see Mozilla, Apple and any other browser embracing Dart sonner. Using pure JavaScript to solve this issue won't let Dart survive forever. So how to make sure that Dart would survive? ghabrianis@gmail.com, Tunisia

A13: Dart is designed to be a productive programming language that compiles to JavaScript. Because developers can write apps with Dart and deploy across the modern web today, the future of Dart is determined by developer adoption.

Q14: If I develop a WebGL game, will I ever be able to target iOS and leverage the performance of the Dart VM or native compilation? Filipe Morgado, Portugal

A14: It is currently an outstanding research project to determine how to port Dart apps to iOS and still remain performant. Luckily, Dart is open source so we look forward to the community exploring this area.

Q15: Are there plans to introduce shared state concurrency and parallelism? Filipe Morgado, Portugal

A15: No, we’re not planning on supporting general shared state concurrency. Having said that, we are very interested in improving our support for concurrent and parallel algorithms.

Q16: Will SIMD support make it into V8? b, sf

A16: V8 implements the ECMAscript standard, so the question is really “will SIMD support make it into ECMAscript” and that is best answered by the ECMAscript committee.

Q17: Will there be an option to see the generated code along with actual Dart code in the editor in future? mdakin, Zurich

A17: That is a very good idea and certainly worth filing a feature request issue on http://dartbug.com/ for. In the meantime, you can output the generated code that the VM produces with this command:

A18: It is hard to explain any programming language to a six-year old, but maybe you could tell him/her that Dart is a tool that might make the next web version of Angry Birds have more pigs and angrier birds?