From: Paul Brannan Date: 2003-03-18T01:29:15+09:00 Subject: Re: Iterator using Continuations On Mon, Mar 17, 2003 at 03:29:28AM +0900, Hans J�rg Hessmann wrote: > What do you think of this approach? Is there an easier way to do it? This looks like a reasonable approach, particularly for an example. Some comments: 1) What happens if @enum.each raises an exception? (I think that it will appear that the exception is coming from #initialize rather than #next, which might not be the desired behavior). 2) This approach to iterating is very slow. It's better to make a few iterations at a time, so you don't have to call @next every time you want a new element. See [ruby-talk:35757] and the following thread for lots of links to other people who have implemented this style of iterator in Ruby. Paul