BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Dart 1.8: An Interview with Seth Ladd of Google

Dart 1.8: An Interview with Seth Ladd of Google

Bookmarks

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
Style

BT