From: Julian Snitow Date: 2003-03-25T17:43:11+09:00 Subject: Re: External iterators all nice and neat (was: Re: Iterate over two lists in parallel) Julian Snitow (i.e., I) wrote: > Here it is, ready to eat, just add > water, etc. You will not find a nicer iterator class, or I will > self.eat(@hat) :-) > [snip] > catch(:iter_done) > while(true) > puts "The next element is: #{iterator.get}" > end > end > > #################################### > > There. Now Ruby has external iterators. ;-) > > Julian > The last bit of the foo.rb example should read: catch(:iter_done) { while(true) x = iterator.get puts "The next element is: #{x}" end } ###### Apparently for some reason "#{iterator.get}" instead of using a static expands weirdly in that loop. (Ruby 1.6.8) /me nibbles the brim of his fedora (not quite hat-eating-worthy, but still... it's good to be humbled every now and then... ) I'm wondering what's inside the string-expansion that changes the behavior like that...