You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
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 checksif ($done) { this.return(); return; }
. This is needed if we want thegetStockPrices
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 bygetStockPrices
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?The text was updated successfully, but these errors were encountered: