zenparsing / es6now

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

Emulating "return" Within Async Generators #27

Closed zenparsing closed 10 years ago

zenparsing commented 10 years ago

As of Node 0.11, V8 does not support the "return" method for generator iterators. Unfortunately, this is crucial for modelling streams with async generators (since we use "return" to close the stream). In order to proceed with experimentation we need to support, emulate, or hack "return".

Options:

  1. Emulate "return" by just calling throw. This is clearly not correct and is quite problematic (since catch blocks might be executed), but it would at least unblock our research to some extent.
  2. Use a generator compiler which supports "return" (i.e. regenerator), somehow.
zenparsing commented 10 years ago

Implemented option 1 in 8af6237.

Solution is compatible with using full generator translation.