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

Revisit standing on Iterators and Generators #2715

Closed
rcampbel opened this issue Jan 20, 2023 · 3 comments
Closed

Revisit standing on Iterators and Generators #2715

rcampbel opened this issue Jan 20, 2023 · 3 comments

Comments

@rcampbel
Copy link

So is there any intention to revisit the standing on Iterators and Generators? I'm mostly instrested specifically in revisiting the advice given in 11.2 Don’t use generators for now.

Reason for asking

  1. The reasons why are based off thoughts and usage that is more then 7+ years old now
  2. Browsers and transpilers have come along way over the last 7+ years
  3. With New APIs and Objects
    Examples where methods on the objects return an iterator and not an array:
    - Map.entries()
    - Set.entries()
@ljharb
Copy link
Collaborator

ljharb commented Jan 20, 2023

I think most of the advice still holds - generators are best avoided, and generators are transpiled the same as they were 7+ years ago.

I agree using iterators is becoming more reasonable, especially with iterator helpers shipping soon, so that section may be revisited in the medium term.

@NagayamaToshiaki
Copy link

@ljharb But hey, why should we transpile generators now? Other than you might use outdated systems, you don't need to.

@ljharb
Copy link
Collaborator

ljharb commented Aug 28, 2023

What systems you use isn't really relevant; what systems you serve to is what you should be maximizing.

Either way, generators are just subpar syntax sugar for creating iterators; there's not much value to be had by using them anyways.

@ljharb ljharb closed this as completed Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants