On 5/21/07, Trans <transfire / gmail.com> wrote:


> I heard rumor that a future Ruby will ultimately pass thru each
> parameters,

I'm not sure that that means in general, but what the current 1.9 does
is to first make Enumerator part of the standard library, and to make
each and other similar methods return an enumerator for the method and
it's parameters in cases where no block is given.

i.e.  (in ruby 1.9)

   e = "abc".each_byte
is equivalent to
   e = "abc".enum_for(:each_byte)

and
   e = array.each_slice(2)
is equivalent to
   e = array.enum_for(:each_slice, 2)

and you can do things like:

   "abc".each_byte.inject {|sum, chr| sum + chr}


-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/