Open ghost opened 1 year ago
Generator functions are just syntax sugar to produce an iterator; that iterator works fine with all of these helpers.
Generator functions are just syntax sugar to produce an iterator
Correction: Generators produce iterable iterators (dubbed IterableIterator
in TypeScript).
@vitaly-t technically true, but all builtin iterators are also iterable, so it's a pretty strong convention that if you make an iterator yourself, it should also be iterable.
It's a bit upside down they way you said it. And iterable is an object capable of creating an iterator. And an iterable object can also expose an iterator protocol, but an iterator object by itself cannot be an iterable.
@vitaly-t yes, it can, which is why Iterator.prototype[Symbol.iterator]
exists as function () { return this; }
, making all builtin iterators iterable - they just provide themselves.
Generator functions are just syntax sugar to produce an iterator; that iterator works fine with all of these helpers.
I didn't get it (about these helpers ? which onces ? you mean mine or in this repo).
Anyway, I just shared some of my hacks I've done in my repo TAOTE, since I found this proposal, I thought probably combining generators, rate limiting, etc would be an inspiration;
The idea of exhaustion (or exception for instance), how is it handled here, Array.every
should return false or true if all values have been seen suggest it is true, but then an exception occured. etc
What about Until
operator (combining two streams), it has always been there in linear time logic (math for formal testing) but never been seen in implementations.
ps: feel free to close if irrelevant, <3
Hi, I just came across this proposal. I was thinking of something in the context of testing streams and found generators as a simple way to stream data. the purpose of this issue is just to share with you my inspiration about it: https://github.com/bacloud23/TAOTE
you find for instance some combining generators functions, which is not present here. rate limiter also.
ps: I'm not the best in JavaScript so this is for inspiration. not addressing anything about the state of today's JavaScript kindly