Thursday, February 16, 2012

Library change: Promise out, Future in!

Posted by Seth Ladd

We have removed the Promise interface from the core libraries. This change is now live in the bleeding_edge branch in source control, and will soon appear in trunk. We encourage you to start migrating to Future now.

I asked Siggi Cherem, engineer on the Dart team, for some background.

Seth: "Future is the future, huh? Sorry I couldn't resist."

Siggi: "Yup. Promise<T> and Future<T> were redundant. We've been migrating all code to use Future, and this change removes the deprecated Promise type."

Seth: "Any differences between Promise and Future?"

Siggi: "The main difference between the two is that in Future we split the code that produces futures, from the code that is used when consuming them. Future<T> is the consumer API, while Completer<T> is the producer API."

Seth: "Thanks!"

Dart is still in Technology Preview, and will continue to undergo changes as we learn more about the language and libraries. Your feedback counts, please try it out and let us know!