From: sto.mar@... Date: 2013-03-05T16:26:19+09:00 Subject: Re: Inconsistent Array#slice behavior? Am 05.03.2013 08:16, schrieb Josh Cheek: > On Tue, Mar 5, 2013 at 1:01 AM, Jack R. > wrote: > > Given x = [], > > x[0, 2] => [] > x[-3,2] => nil > > Documentation says that out-of-range indices produce a nil result, but 0 > s/b out-of-range for an empty array, shouldn't it? > > > Hmm, docs I usually use say "Additionally, an empty array is returned > when the starting index for an element range is at the end of the array. > Returnsnilif the index (or starting index) are out of range." > (http://rdoc.info/stdlib/core/Array:slice) This part of the Array#slice documentation is rather new and didn't make it into the 1.9.3 docs :) (https://bugs.ruby-lang.org/issues/6680) --