4 ms·
I still have to read it through, but why does it require new syntax and not just new standard library additions like boost::coroutine? I just fell in love with
by dmoreno 8y ago
I still have to read it through, but why does it require new syntax and not just new standard library additions like boost::coroutine?
I just fell in love with boost::fiber so i hope there will be also something like it in the future std.
- mattbierner 8y agoThis could be completely off-base but: - Clarity and establishing convention. Boost coroutine2 uses a lot of boostyness to make using coroutines in c++ less painful, but they still require boilerplate and can be quite difficult to write. Understanding code that uses coroutine2 also requires understanding how the coroutine2 library works and how it uses normal c++ syntax in unique ways. Having a dedicated operator like [<-] arguably produces more familiar looking and clearer user code. (Take a look at the generator example in the appendix of this proposal; the implementation of the 'generator' type is horrific but the 'Traverse' function is pretty easy to read.) - Generalization. Boost::coroutine2 targets coroutines. This proposal tries to generalize aspects of the coroutines proposal such as the unwrap operator [<-] to support use cases like linear monads.