Project

General

Profile

Actions

Bug #2422

closed

splat operator fails on array of 1 element

Added by raulparolari (Raul Parolari) almost 12 years ago. Updated over 10 years ago.

Status:
Rejected
Priority:
Normal
ruby -v:
1.9.1
[ruby-core:27003]

Description

=begin
In Ruby 1.9.1:

a, b = *[ 137, 271 ] # a = 137; b = 271 # (as expected)

a = *[ 137 ] # a = [137 ] # (should be 137 !)

Definition of splat (Matz & Flanagan book, p.98): "the array elements replace the array in the original rvalue".
Works as defined in Ruby 1.8; fails in 1.9.1
=end

Actions

Also available in: Atom PDF