> irb
irb(main):001:0> [].unshift()
IndexError: index -1 out of array
        from (irb):1:in `unshift'
        from (irb):1
irb(main):002:0> [].unshift(*[])
IndexError: index -1 out of array
        from (irb):2:in `unshift'
        from (irb):2
irb(main):003:0> [].push(*[])
=> []


I am just trying out the brand new Ruby-1.8.0-preview3.

will the behavier of Array#unshift be fixed ?


Partial solution:

module ArrayZero
	def new_unshift(*ary)
		old_unshift(*ary) unless ary.empty?
	end
	def self.append_features(klass)
		super
		klass.instance_eval do
			alias_method :old_unshift, :unshift
			alias_method :unshift, :new_unshift
		end
	end
end

class Array
	include ArrayZero
end  


--
Simon Strandgaard