
Edward Diener wrote:
Maksym Motornyy wrote: [...]
As of version 2.0 C# will have yield statement. It intended for simplifying iterator development. Yield suspends execution of iterator code and resumes it on next increment. Thus complex traversal iterators are much easier to write in natural loop-like form instead of unroll them.
Nicely stolen from Python <g>.
I think that yield is part of the general concept of coroutines and has not really been invented by Python nor C# (Knuth if I remember correctly). Then again, I did not really read anything about the C# yield, so I'm not sure it is really about coroutines (btw, why the "yield return" syntax and not just "yield"?). Speaking of more Boost centric stuff? There has been any proposal of a coroutine library? I think it should definitely be useful and not really that hard to implement (fibers on windows and makecontext or the setjump/sigaltstack trick on unices). Anyone interested? Regards, ---- Giovanni P. Deretta