From: Bulat Ziganshin Date: 2002-11-20T14:47:21+09:00 Subject: Re: ruby-dev summary 18711-18810 Hello Bob, Tuesday, November 19, 2002, 8:59:03 PM, you wrote: BA> that implements something like this. The implementation uses BA> threads and queues, so is not very efficient. However, an API of BA> this sort could possibly be implemented efficiently at a lower BA> level. Here is the description from the top of the code: ruby iterators insert iterator body in CALL STACK between caller code and block evaluated by iterator - so that you hold a state of iterator body but no state for iterated block caller -> iterator -> block ".next-style" iterators use opposite scheme: outside code -> loop body -> iterator body if you want to hold BOTH state of iterator (local vars, ability to do yield at different places) and state of loop (local vars, ability to do .next at different places) you need coroutines -- Best regards, Bulat mailto:bulatz@integ.ru