-
Notifications
You must be signed in to change notification settings - Fork 14
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
Iterator helpers vs this proposal #1
Comments
Sorry, didn’t notice this issue. I plan to discuss this in the slides but I should have addressed this in the explainer, too.
In addition, the iterator-helpers proposal’s I will add a section to the explainer discussing this proposal’s relationship with the iterator-helpers proposal. |
The creation of helpers for special cases, moreover - duplicated, looks wrong. Much better to create a universal protocol for the conversion of anything to anything else. See tc39/proposal-iterator-helpers#36. It's explained for iterators / iterables, but also works for async iterators / iterables too - see the final example. |
I definitely agree that a general, unified, extensible conversion protocol would be nice and should be proposed in the future – perhaps somehow integrating with transducers. However, Array is JavaScript’s fundamental collection type, and it is privileged in both syntax and API. Having first-class methods for converting to it would be convenient for any developer working in JavaScript. Incrementally extending that use case is the narrow scope of this narrow proposal. Creating an extensible conversion system would require much more deep thought, and deep thought is not necessary to handle this proposal’s specific use case today. (As an aside, it may make sense to add both A general, unified, extensible conversion system is a great idea. But it probably would have enough cross-cutting concerns to warrant its own individual, separate TC39 proposal. I encourage you to write a separate proposal and seek a TC39 delegate to champion it. It is out of scope of this narrow proposal. |
Maybe you're right. |
There is the old stage 1 proposal for Although given the other proposal has been in Stage 1 for years with no progress, I think this proposal focusing on just |
Stage 2 iterator helpers proposal already contains
%AsyncIteratorPrototype%.toArray
method that does absolutely the same. What are the advantages hasArray.asyncFrom
?The text was updated successfully, but these errors were encountered: