Skip to content
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

Some ideas #256

Open
ghost opened this issue Dec 2, 2022 · 6 comments
Open

Some ideas #256

ghost opened this issue Dec 2, 2022 · 6 comments

Comments

@ghost
Copy link

ghost commented Dec 2, 2022

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

@ljharb
Copy link
Member

ljharb commented Dec 2, 2022

Generator functions are just syntax sugar to produce an iterator; that iterator works fine with all of these helpers.

@vitaly-t
Copy link

vitaly-t commented Dec 5, 2022

Generator functions are just syntax sugar to produce an iterator

Correction: Generators produce iterable iterators (dubbed IterableIterator in TypeScript).

@ljharb
Copy link
Member

ljharb commented Dec 5, 2022

@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.

@vitaly-t
Copy link

vitaly-t commented Dec 5, 2022

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.

@ljharb
Copy link
Member

ljharb commented Dec 5, 2022

@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.

@ghost
Copy link
Author

ghost commented Dec 6, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants