Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
lobster_johnson
· 14y ago · 0 comments
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
. 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
) above.
Comments
[–]
arthurschreiber
14y ago
Yes, but enumerators are (in most cases) implemented with Fibers. So you're going to get hit with at least some performance degradation.
[–]
bascule
14y ago
There's another way to do this: just write to the goddamn socket.