On Thu, 1 Feb 2001, Aleksi Niemelwrote: > On Wed, 31 Jan 2001, Dave Thomas wrote: > > Mathieu Bouchard <matju / cam.org> writes: > > > In particular, none of them define "out of range", > > someArray[3,0] #=> [] > > someArray[3,-1] #=> nil > > That is, there's a different between a zero length slice and an > > invalid slice. > Actually once upon a time I prepared a patch to introduce negative > slices which would work like positive, but return reversed array > instead. I wasn't too sure there's really need for the added > complexity. > OTOH, there's so much complexity already that in the name of > consistency we might like to recheck if it would be a good idea. I think it is pretty strange that a range x for which x.length == 0 returns a non-empty array. Array#[] accepts a very special notion of Range. There is probably no hope of changing it to accept Enumerables instead, with compatibility. (supporting both Range and Enumerable is possible, but that's making the beast even more complex.) matju