From: Matthew Smillie Date: 2006-06-11T21:35:45+09:00 Subject: Re: Substrings by Position. On Jun 11, 2006, at 13:08, Charlie wrote: >>> Shouldn't a negative indexing work as well? (Below are just >>> examples, >>> they currently don't work) It will allow strings to be REVERSED >>> easily, >>> and thus doing something new. >> >> Negative indexes do work already. You probably mean negative >> lengths. > > Yes, you're right. It just mean lengths with direction. I don't think that having negative lengths reflect direction is at all a natural decision; it's describing the bounds of a substring, not describing and implicit iteration through individual characters. In other words, if negative lengths worked, I'd fully expect them to work like this (y is negative): foo[x, y] == foo[(x+y), y.abs] e.g. foo = "0123456789" foo[4,-1] # => 3 foo[3, 1] # => 3 foo[4,-2] # => 23 foo[2, 2] # => 23 Conflating string reversal into setting the bounds of the substring is a mistake, I'd say, particularly since there's already a perfectly reasonable String#reverse. matthew smillie.