From: Hal Fulton Date: 2005-04-01T10:56:06+09:00 Subject: Re: Syntax sugar idea for loops Luke Graham wrote: > > Internal and external iterators are equivalent given the existance > of continuations. It may be interesting to explore the possibilities > of representing flow control as an object. To start the debate... > I wanted to jump into this thread, though my reply doesn't follow Luke's directly. I started a thread like this in summer of '02 -- I was looking at some kind of iterator that would allow "normal" (internal) iteration as well as external, and would have features like detecting even/odd, first, and last. An additional problem I wanted to solve was that an element in a collection can't be replaced in that collection unless you know the index, and thus you use each_with_index. And actually, I was just thinking of arrays at that point, as hashes are a different animal. The thread is at: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/46337 or search for "super-iterator"... I've been thinking more about it, and I'd do it a little differently now... maybe I'll get a chance to implement that soon. Cheers, Hal