Hi,

In message "[ruby-talk:6568] Re: RangeError vs. IndexError"
    on 00/11/24, Robert Feldt <feldt / ce.chalmers.se> writes:

|> Traditionally RangeError is used to describe numerical ranges.
|>
|Do you mean that RangeError should only be used when there's a problem
|relating to instances of class Range?

No.  I believed all usage of RangeError is related with numerical
range, e.g. "integer too big to convert" etc.  But that was false
belief.  When I grep'ed the code later, I found too many exceptions.
Sorry for confusing you.

Then here's the facts (I hope they aren't false facts):

  * RangeError is a subclass of StandardError.

  * FloatDomainError is a subclass of RangeError.

  * when something is out of range;

    (a) if something is an index, use IndexError.

    (b) otherwise, use RangeError.

And here's the answer for your next question:

  Historical reason.

I introduced IndexError first.  Then I came to need to describe
something which was not an index.  It might have been good to unify
these exceptions.  Making IndexError a subclass of RangeError might
make things clear.  Let me think about it for 1.7.

							matz.