zenparsing / es6now

ECMAScript 6 to 5 Compiler and Runtime Environment
MIT License
29 stars 2 forks source link

Hook for Async Iteration #29

Closed zenparsing closed 10 years ago

zenparsing commented 10 years ago

What should the hook for async iteration be?

  1. Using [Symbol.iterator].
  2. Using a new symbol.

Analyze the tradeoffs for each option.

zenparsing commented 10 years ago

We use [Symbol.iterator] for the hook. Essentially, we are expanding the interface for Iterable. Each of the generator functions (next, return, and throw) are defined as returning either IteratorResult or Promise<IteratorResult>.