News for hackers. Stuff that matters.
Re:Adding a Python style yield to C++ by ggchappell on Monday April 26, 2010 @03:58PM (#1295792)
Interesting, but I wonder whether Go-style "go routines" and channels would be a better choice to implement.

First, it seems like they would be easier to write in C++. You're mostly creating a new kind of pseudo-container (channel), instead of trying to fake adding new syntax to the language. (Although you do still need to have some mechanism for executing a go routine, somehow ....)

Second, its a more powerful abstraction. With go routines it's not hard to implement something with the functionality of Python-esque generators, but you can also do fancier things that you would have a difficult time doing using only generators.

There are no comments on this comment yet.