Change the name of ArrayBoundsException in druntime

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Oct 23 12:51:13 PDT 2008


Bill Baxter wrote:
> On Fri, Oct 24, 2008 at 4:08 AM, Andrei Alexandrescu
>> By the way, this each-exception-has-its-type crap is my #2 pet peeve after
>> "Follow carefully my pocket watch... OO is good for everything... OO is good
>> for everything... to use, inherit... to use, inherit..."
> 
> Interesting point.  The whole catch(A){} catch(B){} catch(C){} thing
> is basically if-then-else on very similar types, which is exactly what
> the OO crowd says you should try to avoid in any other situation.  You
> should be using polymorphism!

Yes!

> But ok, types are good for one thing, and that's ensuring global
> uniqueness.  That seems to be the real point of the billion exception
> types, to give them unique identifiers that the compiler can check.
> You can give your exceptions a typecode or a string identifier, like
> your origin=="sql", but then the compiler won't tell you if your type
> is unique.  And it won't tell you there's a problem if you mistakenly
> type origin=="SQL" instead of "sql".

The module name can supplant that.

> I think it boils down to a kind of static typing vs dynamic typing argument.

To some extent, yes. But, I think an adept of static typing should also 
recognize when it brings nothing to the table, and IMHO exceptions are 
one of those cases.


Andrei



More information about the Digitalmars-d mailing list