Nick Coghlan wrote:
(this is why I disagree with Greg that "yield from" can serve as the one true API - it doesn't handle partial iteration, and it doesn't handle pre- or post- processing around the suspension points while iterating).
I'm aware of the iteration problem, but I'm not convinced that the convolutions necessary to make it possible to use a for-loop for this are worth the bother, as opposed to simply accepting that you can't use the for statement in this situation, and using some other kind of loop.
In any case, even if we decide to provide a scheduler instruction to enable using for-loops on suspendable iterators somehow, it doesn't follow that we should use scheduler instructions for anything *else*.
I would consider such a scheduler instruction to be a stopgap measure until we can find a better solution -- just as yield-from is a better solution than using "call" and "return" scheduler instructions.