-
Notifications
You must be signed in to change notification settings - Fork 10
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
Support AGen specification for asynchronous generators #9
Comments
Right now the AGen spec has some thought into it to handle the majority of the common use cases without external helper libraries. If we can get some minimal interop between generator runner libraries you can start exporting generator functions on npm and use Feedback is welcome on what a good minimal set of runner functionality is so that generator functions exported by modules can work with multiple runners |
I don't understand. If we can't agree no what asynchrony to use, where is the interop? A library would have to support all the possible types to be universally useful. |
@creationix where all possible types is currently promises & continuables. I should update gens to support promises. We could define a third interface for all other asynchronies that everyone else that is not promises / continuables would have to define. Maybe I should add some functionality to the AGen repo that allows you to treat arbitrary asynchrony with a simple callback api so that runner authors only have to use those functions. |
@creationix Because there's no reason, need or benefit to adopting a whitelist of supported Asynchrony. If the list is large, then the spec becomes cumbersome, and if the list is small, then supporting additional types becomes trivial. If all current potential AGen implementations already support promises and continuables, it's a moot point. What is the logic in supporting asynchrony that you don't use or consume? |
I guess I don't understand the point of this proposal then? What's the goal here? What's the interop we're trying to gain? |
the aim is to define the minimum stuff needed to publish generators on npm and have them work with multiple generator runners. We do run into the problem of "what can you yield", for which I don't have a good answer other then 'at least promises and continuables' I did abstract that asynchrony differences stuff out into https://github.com/Raynos/gens/blob/master/asynchrony.js and have added support for promises to my thing & tests. |
The lack of whitelisted Asynchrony seems to be a hangup from a feedback perspective, so perhaps we should just add thunk & promises as they're both (eventually) built-in. |
To generate discussion, feedback and achieve interoperability:
You know the details, but for anyone else coming here...
@Raynos and I put together the AGen specification with your feedback for asynchronous generators, generators + asynchrony (e.g., promises, continuables, etc...) which we're using in our own libraries (gens) to create a cohesive specification for asynchronous generator interoperability.
Some highlights:
yield
) or parallel (yield [...]
) execution.The text was updated successfully, but these errors were encountered: