Discussion:
[dart-misc] [dart-announce] Breaking Change - More types for Future.timeout
'Florian Loitsch' via Dart Announcements
2016-02-09 18:04:50 UTC
Permalink
I just landed a patch [0] that adds more types to the Future.timeout
function. It's unlikely, but there is a chance that a program could now
fail in checked mode.

We changed the signature from the timeout function from:
Future timeout(Duration timeLimit, {onTimeout()});
to
Future<T> timeout(Duration timeLimit, {onTimeout()});

This implies that the `onTimeout` function must return a T (or a Future<T>)
now.

If you rely on the old behavior, you can work around the new types by
introducing a `.then`:

typedFuture.timeout(...)
becomes
typedFuture.then((x) => x).timeout(...)

// florian

[0]
https://github.com/dart-lang/sdk/commit/963f653b12c57c22b4c1252e70bc5468846eb23b
--
For more news and information, visit https://plus.google.com/+dartlang

To join the conversation, visit https://groups.google.com/a/dartlang.org/
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Jan Mostert
2016-02-10 08:08:36 UTC
Permalink
In which version will this be released?


On Tue, 9 Feb 2016 at 20:05 'Florian Loitsch' via Dart Announcements <
Post by 'Florian Loitsch' via Dart Announcements
I just landed a patch [0] that adds more types to the Future.timeout
function. It's unlikely, but there is a chance that a program could now
fail in checked mode.
Future timeout(Duration timeLimit, {onTimeout()});
to
Future<T> timeout(Duration timeLimit, {onTimeout()});
This implies that the `onTimeout` function must return a T (or a
Future<T>) now.
If you rely on the old behavior, you can work around the new types by
typedFuture.timeout(...)
becomes
typedFuture.then((x) => x).timeout(...)
// florian
[0]
https://github.com/dart-lang/sdk/commit/963f653b12c57c22b4c1252e70bc5468846eb23b
--
For more news and information, visit https://plus.google.com/+dartlang
To join the conversation, visit https://groups.google.com/a/dartlang.org/
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Loading...