-
Notifications
You must be signed in to change notification settings - Fork 16
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
future methods on iterator helpers #35
Comments
So I can give you some information about what I've seen at scale, with some anecdotes from Google's HUGE number of build targets using RxJS.
From the above listSome are popular some are not. Very Popular
Somewhat Popular
Rarely Used
Almost never used
Async Temporal OperatorsThere's a bunch of operations that can be done over async collections ( These are the most popular by far:
Other popular operations:There's some other very popular operations that might work on any of the types in question, in particular
@bakkot I'm happy to help with your AsyncIterator helpers proposal... if it's not too late. |
Thanks for the info @benlesh! Some thoughts:
That was initially surprising to me, but thinking about it more it makes sense because observables are so often treated as being essentially unordered. For iterators (async or otherwise) I think it's more usual to rely on the order, so
Yeah, I also don't use this much.
I do like these, but I'd like to start by getting generic function-based
Yeah, I can't think of how those could possibly make sense on iterators. Seperately, they're also kind of scary - I'm not sure I'd want to make those operations easy to reach for.
It's definitely not too late for input on details, though for the initial version we're pretty settled on the high-level design and the set of combinators (i.e., just those in the initial version of the iterator helpers proposal, plus something like |
So, the uses for
Between the two, |
+1 on into/pipe. It reduces and simplifies the api surface for learnability, reduces future name conflicts, enables custom operators (e.g., combineLatest), simplifies operator composition, and enables other utility libraries to fill in api gaps without waiting for language additions. Separately, if I understand correctly, the promisifying methods combine concerns that result in redundant functionality and preventable naming challenges. Consider separating the concerns of promisification from the concerns of what gets promisified? e.g., with a method called
composing custom operations like preventDefault
creating custom operators like
|
In a (probably poorly conducted) poll of ~800 respondents on what RxJS operators they use, The top twenty are:
Overall, this surprises me a little bit in some cases. I knew
|
@michaelficarra and I have been thinking about what other iterator helper methods we'd like to pursue, and have the following extremely tentative list. This doesn't represent the opinion of TC39 as a whole - it's just what we are personally interested in. This is not necessarily actionable for you; I just wanted to give a heads up.
zip
/zipWith
/ (maybe)zipLongest
chunks
/windows
(chunks
would group outputs into a chunk everyn
items,windows
would give you a sliding window of the lastn
items)concat
join
(like onArray.prototype
)tap
finally
; ideally these would be designed in concert)of
(like onArray
)takeWhile
/dropWhile
scan
into
(i.e.function(arg) { return arg(this); }
- handy for chaining / custom operators; RxJS spells thispipe
)The text was updated successfully, but these errors were encountered: