Change the name of ArrayBoundsException in druntime

Sean Kelly sean at invisibleduck.org
Fri Oct 31 15:55:04 PDT 2008


Jesse Phillips wrote:
> On Sat, 25 Oct 2008 15:45:51 -0700, Robert Fraser wrote:
> 
>> Jesse Phillips wrote:
>>>
>>> D doesn't force a try or throw of exceptions for this very reason;
>>> people usually use the catch(Exception) because they don't know what
>>> needs to be caught and don't care but are forced to catch it, not
>>> because their program is crashing from an exception (well, that is what
>>> I do).
>> People also use it to say to the user "this didn't work; try something
>> else"? In 99% of cases, this is fine, but when memory is involved, the
>> programmer has a whole lot more to think about and would often want to
>> catch the memory exception at a higher level.
> 
> Oops, from past discussions about the difference I somehow got the idea 
> that an Error couldn't be caught.
> 
> While out of memory still falls under recoverable, I can see why putting 
> greater importance over other exceptions would be good.

After some thought, I'm inclined to agree.  While an OOM condition might 
be recoverable without any explicit effort, I think it's a good idea to 
encourage that it receive special handling by classifying it as an 
Error.  Since D is a systems language I don't consider any error 
condition to be necessarily unrecoverable anyway, so reclassifying 
OutOfMemory doesn't imply anything to me other than that it should be 
handled explicitly rather than accidentally by trapping and tossing out 
out as an Exception.


Sean



More information about the Digitalmars-d mailing list