Implement Symbol.asyncIterator on Observable #6779
benlesh
started this conversation in
Ideas / Feature request
Replies: 1 comment
-
Core Team Aye: 5, No Opinion: 1 (OJ) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Thinking about the backpressure-related use cases for interop between async iterables and observable, I think I'd consider it an improvement to ergonomics to implement
Symbol.asyncIterator
onObservable
. See this comment here about handling backpressure. There are some really cool/easy/clever things that can be done with this functionality.Here's a few things to consider:
concatMap
has exactly the same issue where users need to "understand there is buffering" in some cases, and so far, I haven't seen many people trip over that. In fact, many tutorials and documents steer people towardsconcatMap
for this buffered, one-at-a-time behavior more often than not.for await
isn't going away any time soon, and — other than callbacks — is the only real native way to iterate async values (one-at-a-time likeconcatMap
, of course).for await
is obviously non-cancellable, as there's no subscription or even an opportunity to pass a signal or the like, so it's unlikely to "replace" callingsubscribe
in the hearts and minds of users.For those new to this, here is what is being proposed (roughly):
Which would roughly map 1-to-1 with this RxJS behavior:
cc @cartant @kwonoj
Beta Was this translation helpful? Give feedback.
All reactions