3 ms·
Ruby solves the inversion of control with enumerators (not to be confused with Enumerable): http://www.ruby-doc.org/core-1.9.3/Enumerator.html http://www.ruby-d
by lobster_johnson 14y ago
Ruby solves the inversion of control with enumerators (not to be confused with Enumerable): http://www.ruby-doc.org/core-1.9.3/Enumerator.html http://www.ruby-doc.org/core-1.9.3/Enumerator.html. It's similar to Python's generators and `yield`, letting you write imperative, sequential code that is executed at the behest of a caller. See randomdata's comment (http://news.ycombinator.com/item?id=4314810 http://news.ycombinator.com/item?id=4314810) above.
- arthurschreiber 14y agoYes, but enumerators are (in most cases) implemented with Fibers. So you're going to get hit with at least some performance degradation.
- bascule 14y agoThere's another way to do this: just write to the goddamn socket.