From: Martin DeMello Date: 2005-06-05T15:40:25+09:00 Subject: Re: internal iterators in ruby Geert Fannes wrote: > So, if I understand well, the problem with iterating over different > enumerables synchronously has to do with the absence of a #rewind and > #next method for enumerables. The Generator class solves this using the > slow #callcc method and allows one to step through the Enumerable#each > method, element by element. Wouldn't it be better if the enumerable > required a #rewind and #next method and constructs the #each method out > of these instead of doing the reverse using #callcc? Note that an internal iterator is a (capable of being atomic) method, whereas an external iterator is an *object* holding the state of the iterator. If you want to implement #next, you need somewhere to store @current, and the object you're iterating over is not that place. martin