Re:Why C++ for Unreal 4
by anon4 on Tuesday April 15, 2014 @03:16AM
(#7590699)
Yield and generators (i.e. save stack; return value to caller; receive value from caller) are really a language feature for writing a runtime for a different language with coroutines. Or if you're willing to write your program in a way that looks like it was generated by a source-to-source transformation tool, you can write your coroutines on top of them. The most basic construct is something like this:
And this is pretty much it. A simple example for two coroutines that pass control to each other would be:
You can do the same with javascript and events, but it requires a much higher degree of masochism.
[ Parent
| on HN ]
There are no comments on this comment yet.