From: Daniel Berger Date: 2003-06-18T03:20:16+09:00 Subject: Re: [RCR] Array#push(empty array expanded) => no exception Simon Strandgaard wrote: > This strange behavier really surprised me.. > > irb(main):006:0> [].push(*[]) > ArgumentError: wrong number arguments (at least 1) > from (irb):6:in `push' > from (irb):6 > > > Why is it illigal to concatenate an empty set ? > I expected Rubys Array class to work just like a normal set. > This seems *VERY* non-intuitive to me (POLS). > > Array#unshift doesn't like zero arguments neither. > > > An ugly hack to avoid it could be: > @data.unshift(*objs) unless objs.empty? > > > > Can it be made legal to push/unshift with zero arguments ? > > -- > Simon Strandgaard Already fixed in (later) versions of 1.8 ruby -v -> ruby 1.8.0 (2003-06-14) [sparc-solaris2.9] irb(main):004:0> [].push(*[]) => [] Regards, Dan