From: Christopher Dicely Date: 2011-05-19T22:51:43+09:00 Subject: Re: Making fibers enumerable On Wed, May 18, 2011 at 8:50 AM, Rahul Kumar wrote: > On Wed, May 18, 2011 at 4:42 PM, Robert Klemme > wrote: > >> >> > If I understand correctly, writing generators was one of the purposes of >> > fibers. Why can't fibers be made enumerable by default? >> >> I am not sure how that interacts with the original intent of Fibers: >> their main purpose is to bring coroutines to Ruby. >> >> http://en.wikipedia.org/wiki/Coroutines > > > Right. But aren't semi co-routines(don't send data; just receive) used to > implement generators? Ruby fibers can be either semi-coroutines or full co-routines. And while replacing continuations as the basis for implementing generators was certainly an important motivation for implementing fibers in Ruby, that's not the only thing fibers can do, and enumerability may not make sense for other fibers. So, usually, Enumerator::Generator is used for generators (though that uses Fiber behind the scenes) and Fiber is used directly for other use cases.