BT

Dart 1.8: An Interview with Seth Ladd of Google

| by James Chesters Follow 1 Followers on Dec 16, 2014. Estimated reading time: 3 minutes |

Google has released version 1.8 of its open source web programming language Dart. The release brings with it experimental support for enums, described by developer advocate Seth Ladd as one of the project's "most requested features." InfoQ sat down with Ladd to get more information about this feature, and the latest info on the Dart project.

InfoQ: ​Seth, you mention Enums is one of the most requested features in Dart. What's so great about Enums, what do they do that was missing in Dart? Why should someone care about them?

Ladd: Enums help developers express clear intent with minimal code, and help tools catch potential bugs. Developers can use enums as a convenient way to give a name to a set (or: enumeration) of related terms or values.

For developers who like to see code, here is an example: Before enums, this is how a developer would have had to specify the business form states (OPEN, INPROGRESS, and CLOSED):

// Before enums
class FormState {
  static const FormState OPEN = const FormState._(0);
  static const FormState INPROGRESS = const FormState._(1);
  static const FormState CLOSED = const FormState._(2);
  final int value;
  const FormState._(this.value);
  static const List values = const [OPEN, INPROGRESS, CLOSED];
}

With proper support for enums, it gets a lot simpler:

enum FormState { OPEN, INPROGRESS, CLOSED }

The new syntax helps developers identify potential bugs. Enums are often used in switch statements. To help developers ensure they handle all possible values in an enum, the Dart tools can warn when an explicit case is missing.

InfoQ: Enums support is described as an "experimental feature." How will it be determined if the experiment with them has been a success?​​

Ladd:The Dart 1.8 release labeled enums as "experimental" because, while the language spec is complete and awaiting ratification by ECMA TC52, we want to ensure that all of our tools work well with enums. We hope developers start to use enums today, and report any implementation issues. We expect to remove the "experimental" label very soon.

InfoQ: How would you characterise the developer community's response to the experimental release of Enums support?

Ladd: Dart 1.8 is pretty new, so feedback is still coming in. However, enums are one of the community's top requested features, so we're excited to see how developers use enums. Some developers have asked for the ability to assign an integer value to an enum value, which is a feature request that can be evaluated in a future ECMA TC52 meeting.

InfoQ: There are several other changes with the 1.8 release, aside from Enums. Can you give our readers a little more detail on these?

Ladd: In Dart 1.8, the new JsonUtf8Encoder was added to help developers write more performant servers. We noticed that decoding JSON as UTF8 was a very common operation, and we wanted to provide an optimized solution.

There were other small tweaks to APIs, mainly to enhance developer productivity.

InfoQ: What can InfoQ readers expect from the Dart 1.9 release -- and are there are sneak previews of 2.0 you can tell our readers about?

Ladd: We are working on our implementation of async / await, a language feature that helps developers write asynchronous code. Using async / await, developers can write asynchronous code that "looks and feels" more like synchronous code. This means less chance to get into "callback hell".

We don't have anything to share about Dart 2.0. We expect to produce a Dart 1.10 after 1.9.

InfoQ: Do you have any further comments, or is there anything not covered you'd like to address?​

Ladd: We hope developers join us at (or tune into) our first Dart Summit, held in San Francisco, California in April 2015. The summit is a good opportunity to learn all about Dart, straight from our engineers and the Dart community. The Call for Presentation proposals is open now.

The Dart team welcome contributions to the project. InfoQ readers looking to contribute to Dart can help by reporting bugs and answering questions on StackOverflow, as well as contributing code. More information on contributing to Dart is here.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

A related project by Federico Dal Maso

I suggest to the readers to take a look at scala.js project too. It is quite similar to Dart-to-js transpiler, but with full support of Scala language features.

Enums is one of the most requested features in Dart by Andrew Mezoni

This sound great: Enums is one of the most requested features in Dart, within a last three years, since 2011.

How Google promotes Dart with enterprises? by Yakov Fain

I like Dart as a programming language. We've even developed and released in production an application built with Dart and AngularDart. But if Google will not have a dedicated sales team pushing Dart into enterprises, it may remain just another nice language.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

3 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT