yield return
and await
/async
are just different specialized forms of coroutines. You've shown that you can (essentially) implement yield return
using await
/async
, and I would not be surprised to find that it were possible the other way around. I'm sure that they are implemented in a very similar manner.
In practice, of course, I would not use await
/async
for iteration, since yield return
is much simpler and more clear.
So,
- You can probably take this "abuse" as far as you want.
- Not sufficiently familiar with F# to answer.
- No, but IIRC the features are implemented in more or less the same way.