In porting some automation code from 1.8.7 to 1.9.1, I find that in ruby
1.8 the following generated code (real code is unpacking binary strings
and assigning variables, but I simplify for clarity, although the result
may look a bit silly) worked:

  var1                     = *[ val1 ]                       # var1 =
val1
  var1, var2, varn = *[ val1, val2, valn ]   #       ,,

(the splat is not necessary in the second case, but this allowed the
code to be generated in the same way, regardless of array size).

With Ruby 1.9.1-p243, instead, this happens:

   var1                      = *[ val1 ]                     # var1 = [
val1 ]  (!)
   var1, var2, varn = *[ val1, val2, valn ]   # var1 = val1

So in the first case, var1 became an array (instead than the expected
integer).
Of course, this can be fixed by generating code that checks the array
size (and doing a shift if 1, etc). But I am curious on this behavior of
splat when the array contains one element (I read about the
differences/new features of splat in 1.9, but they seem to have nothing
to do with this). Does anyone know if it is a bug?

Thanks

Raul Parolari
-- 
Posted via http://www.ruby-forum.com/.