:P Look, I felt dirty enough just reading the C# code for an idiomatic usage of an iterator ...
Obviously, in a compiled language that you control, you could take that block and turn its contents into a method of a class for speed.
Conceptually, much easier to understand the base case: that you're passing in an anonymous function.
In ruby, since they let you pass blocks around as objects, suddenly, poof, you can understand and implement ruby's iteration, just by learning about blocks and seeing a snippet of code.
I like how, when they're talking about how to handle ITERATION, they say "we thought about coroutines; we thought about continuations; we settled on what we've got now" ... thinking about how I'd do it in CL (if I were writing a library to make iterator-style programming more friendly, perhaps as a macro), I have to say I wouldn't have immediately thought of using either of those. :P
Of course, I suppose for their target market, features that let you "roll your own x", for almost any x, are far too dangerous to allow. Ugh.
Obviously, in a compiled language that you control, you could take that block and turn its contents into a method of a class for speed.
Conceptually, much easier to understand the base case: that you're passing in an anonymous function.
In ruby, since they let you pass blocks around as objects, suddenly, poof, you can understand and implement ruby's iteration, just by learning about blocks and seeing a snippet of code.
I like how, when they're talking about how to handle ITERATION, they say "we thought about coroutines; we thought about continuations; we settled on what we've got now" ... thinking about how I'd do it in CL (if I were writing a library to make iterator-style programming more friendly, perhaps as a macro), I have to say I wouldn't have immediately thought of using either of those. :P
Of course, I suppose for their target market, features that let you "roll your own x", for almost any x, are far too dangerous to allow. Ugh.
C# code makes mr_luc sad.