From: James Edward Gray II Date: 2006-10-13T22:18:43+09:00 Subject: Re: Silent out-of-index problems--how much of a problem are they really? On Oct 12, 2006, at 11:34 PM, Kenneth McDonald wrote: > As a Python user starting to mess around with Ruby, one of my > biggest concerns is the fact that so many operations on lists 'fail > silently' (return nil) when given list indices that are out of bounds. As has been shown, Array does include a fetch() method that throws IndexError. I would say the fact that Ruby has an entire error type just for this case shows that it is not being ignored. In practice, this just isn't much of an issue in Ruby. Like off-by- one errors, this pretty much just goes away with the pervasive use of iterators. > So my question is, _in practice_, how difficult is it to track down > index-out-of-bounds-errors in Ruby? Well, Rubyists are big fans of Test Driven Development (TDD). Two of the many advantages of TDD are that it causes you to write very small methods and isolate the issues of those methods with tightly focused tests. When doing this, it should be fairly rare that you are scanning hundreds of line of code for a trivial out of bounds error like this. That's why we like it. ;) James Edward Gray II