daz wrote:

>Fine, but see |*a| in Array examples below.
>Where would the index go (?)
>
If an assignment contains more lvalues than rvalues, the excess lvalues 
are set to nil.
If an assignment contains more rvalues than lvalues, the excess rvalues 
are ignores.

There are exceptions, however, for just one lvalue or just one rvalue.

a = 1,2            #=> [1, 2]
a                  #=> [1, 2]
a,b = [1,2]        #=> [1, 2]
[a,b]              #=> [1, 2]

I'm proposing we get rid of these heuristics. They can be explicitly be 
enabled using asterisks.

*a = 1,2           #=> [1, 2]
a                  #=> [1, 2]
a,b = *[1,2]       #=> [1, 2]
[a,b]              #=> [1, 2]

So that the new result without *s would be:

a = 1,2            #=> [1, 2]
a                  #=> 1
a,b = [1,2]        #=> [1, 2]
[a,b]              #=> [[1, 2], nil]


This way, one could implement the C-equivalent of

class Array
  alias_method :old_each, :each
  def each
    index = 0
    old_each do |obj|
      yield obj, index
      index += 1
    end
  end
end

and then call:

["cat","dog","pin"].each {|obj| p obj}
["cat","dog","pin"].each {|obj,idx| puts "#{obj} at #{idx}"}

No doubt, this is strongly backwards-incompatible, but who am I to care? :P

Devin
...not a fan of Microsoft Clippy.