Bug #2053: `for` No Longer Splats When RHS Returns More Values Than LHS Expects
http://redmine.ruby-lang.org/issues/show/2053

Author: Run Paint Run Run
Status: Open, Priority: Normal
Category: core
ruby -v: ruby 1.9.2dev (2009-09-05 trunk 24762) [i686-linux]

$ cat /tmp/for.rb 
  class OFor
    def each
      [[1,2,3], [4,5,6]].each do |a|
        yield(a[0],a[1],a[2])
      end
    end
  end
  
  o = OFor.new
  qs = []
  for q in o
    qs << q
  end
  p qs
  p q

  $ ruby8 -v /tmp/for.rb 
  ruby 1.8.8dev (2009-09-04) [i686-linux]
  /tmp/for.rb:11: warning: multiple values for a block parameter (3 for 1)
  	from /tmp/for.rb:4
  /tmp/for.rb:11: warning: multiple values for a block parameter (3 for 1)
  	from /tmp/for.rb:4
  [[1, 2, 3], [4, 5, 6]]
  [4, 5, 6]

  $ ruby -v /tmp/for.rb 
  ruby 1.9.2dev (2009-09-05 trunk 24762) [i686-linux]
  [1, 4]
  4


----------------------------------------
http://redmine.ruby-lang.org