From: Sam Gentle Date: 2005-12-03T21:04:17+09:00 Subject: Re: Range oddity On 12/3/05, Adam Shelly wrote: > Why can I create a Range where one end is a String and the other is an > Array? I can't do anything with it. I get an error if I create an > Fixnum..Array range, why don't I get one for the String..Array? If anyone's curious about the internals behind this - I had a look when I had a similar problem. Range checks for the validity of a..b by calling a <=> b and ensuring that the return value isn't nil. You can see the results yourself by trying that with different values. For some reason, in 1.8.2 strings return false instead of nil when compared with a value they don't know how to handle. This sneaks past Range's test. As David mentions, this seems to have been fixed in 1.8.3. Sam