Change the name of ArrayBoundsException in druntime
Sean Kelly
sean at invisibleduck.org
Wed Oct 22 16:13:16 PDT 2008
Jason House wrote:
> Sean Kelly Wrote:
>
>> Denis Koroskin wrote:
>>> On Wed, 22 Oct 2008 16:22:02 +0400, Jarrett Billingsley
>>> <jarrett.billingsley at gmail.com> wrote:
>>>
>>>> On Wed, Oct 22, 2008 at 6:49 AM, Jacob Carlborg <doobnet at gmail.com>
>>>> wrote:
>>>>> I think the name ArrayBoundsException should be changed to a more
>>>>> general
>>>>> name like BoundsException, OutOfBoundsException or
>>>>> IndexOutOfBoundsException. Then you can use the exception in every class
>>>>> that have some sort of index operation and not just for an array/array
>>>>> class.
>>>>>
>>>> 2nded.
>>> Agreed. BTW, why it is not an Error but Exception?
>> The Error class was created shortly before release and I didn't get
>> around to reclassifying the exceptions in druntime. From memory though,
>> I think that OutOfMemoryException and UtfException should remain as-is,
>> but the remaining exceptions should probably be errors. Any objections?
>
> What is the criteria for choosing exception verses error? How would this tie into non-recoverable errors discussed with pure function exception handling?
Errors represent situations which are typically non-recoverable--program
logic errors, for example, or situations where data corruption may have
occurred--while Exceptions represent the bulk of normal execution
errors, including OutOfMemory conditions.
Regarding pure functions... are you talking about the nothrow guarantee?
I haven't given it much thought, but I'd be inclined to say that it's
legal for a nothrow function to actually throw a child of Error but not
Exception. That ignores OutOfMemoryException though, which is something
that the programmer shouldn't have to handle. At the same time, I'd
consider an out of memory condition to be quite recoverable, so...
Sean
More information about the Digitalmars-d
mailing list