3 ms·
> Soon Python and Ruby won't have any advantages left in writing beautiful, clear, correct, bug-free, and easy to read code Does that mean C++17 will finally g
by contravariant 10y ago
> Soon Python and Ruby won't have any advantages left in writing beautiful, clear, correct, bug-free, and easy to read code
Does that mean C++17 will finally get support for the generator pattern?
- tathougies 10y agoThe generator pattern is really not that fundamental a language construct, and, in general, is quite straightforward to implement in languages with powerful enough abstractions. C++ is one such language: http://www.boost.org/doc/libs/1_62_0/libs/coroutine/doc/html/coroutine/coroutine/asymmetric.html http://www.boost.org/doc/libs/1_62_0/libs/coroutine/doc/html...
- gpderetta 10y agoI wouldn't call it straightforward, boost.coroutine requires custom assembler for its implementation. Then again, stackfull coroutines are significantly more powerful than generators available in most other programming languages (notable recent exceptions are Go and Lua). Boost.asio provides stackless generators [1] implemented purely in C++, by (ab)using the preprocessor and the switch statement. [1] http://www.boost.org/doc/libs/1_62_0/doc/html/boost_asio/overview/core/coroutine.html http://www.boost.org/doc/libs/1_62_0/doc/html/boost_asio/ove...