... Heh, no, yield isn't the same as a continuation.
Yield, for iterators at least, is basically just calling a function that you've passed in.
In Ruby (and now C#) and many other languages, there's what appears to be syntactic sugar around this idiom, and especially in C# it's a bear to follow what's happening because of the sea of syntax.
But all that's really happening is, you pass in an anonymous function, and when the iterator calls yield(x), it calls that anonymous function with x.
In C#, you're saying
okay, for this foreach doodle with a variable i, HereIsAnInterator(initialized) {
but you can imagine this whole block as
a function that gets called with i
every time yield() is called.
}
Behind the scenes, the stuff between the braces gets turned into a function f, and attached to HereIsAnIterator, accessible via (at least) yield().
Yield for iterators is just sugar around an anonymous function.
Continuations are a whole other bag o worms. (edit: originally invented as a powerful memory-wasting device, some people now find them almost useful ;) ).
: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.