-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
syntax support for Stream programming #7002
Comments
cc @floitschG. |
This comment was originally written by [email protected] Thank you for the excellent issue description! |
This comment was originally written by @seaneagan Related idea... async generators (issue #36 is sync generators). Functions which use ( Examples:
Stream everyOtherEvent(Stream stream) {
/// Think... "Connection error... retrying in <x seconds>" |
The Dart spec now includes async* methods and await for loops. Not fully implemented yet, but in progress. I'm closing this bug as "Done" from the language perspective. Added Done label. |
This issue was originally filed by @seaneagan
In the same way that programming with Futures could benefit from language support (issue #104), programming with Streams could as well. Streams are essentially async Iterables, so an async version of the "for" statement could work for Streams. It probably makes sense to call it "on" which is already a contextual keyword elsewhere. As an example the implementation of the Iterable-based methods on Stream could look identical to how they are in Iterable except replacing "on" with "for":
async bool any(bool f(E e)) {
on(var e in this) {
if(f(e)) return true;
}
return false;
}
notes:
* the "on" statement would trigger a "subscribe" to the Stream passing onData, onDone, and onError resulting in a StreamSubscription
Initial mailing list discussion:
http://goo.gl/8PqcP
The text was updated successfully, but these errors were encountered: