From: "Hans Jörg Hessmann" Date: 2003-03-18T09:33:43+09:00 Subject: Re: Iterator using Continuations > 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. Well, I thought it was a good solution that shows an extraordinary ruby-feature. But I didn't check the performance. It's really too slow for real-world applications. It looks like there is no better solution than using some sort of pipe. Anyway, Gavin is right: continuations are nothing for a ruby intoduction. But I stumbled over this problem during my preparation and it made me curious. It least I've learned something and it was a bit of fun. Thanks, Hans J�rg