-
Notifications
You must be signed in to change notification settings - Fork 19
Description
I currently trying to implement a working prototype for async generators on top of Traceur, and (at least) one issue has come up:
Consider the function that is given as an example, namely async function* getStockPrices(stockNames, nameServiceUrl). In the provided transcription into an asynchronous function, the code is full of checks if ($done) { this.return(); return; }. This is needed if we want the getStockPrices observable to return as soon as possible.
However, I wonder whether this is really what one wants: If I wrap several of the await expressions in getStockPrices in one async function, which is then called by getStockPrices there will be only one check whether I'm done or not, but not one for every await in the wrapping function. Thus we would lose transparency here (between wrapped and non-wrapped code).
Doesn't it make more sense to test for stopping just before the next yield that is going to happen?