Change the name of ArrayBoundsException in druntime

Sergey Gromov snake.scaly at gmail.com
Thu Oct 23 17:49:07 PDT 2008


Fri, 24 Oct 2008 08:54:49 +0900,
Bill Baxter wrote:
> On Fri, Oct 24, 2008 at 6:47 AM, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
> > Sergey Gromov wrote:
> >>
> >> Thu, 23 Oct 2008 14:44:46 -0500,
> >> Andrei Alexandrescu wrote:
> >>>
> >>> Sorry, I meant to catch Exception. My point was, if I want to print an
> >>> informative message, the exception should be able to provide it without
> >>> having to encode it in its type.
> >>
> >> It's all nice and simple until you want to localize.  Then all your
> >> 'informative compiler-provided messages' appear as garbage to a non-
> >> English-speaking user.  They need to be translated somehow.  And the
> >> translation is likely to be based upon the context, not upon an arbitrary
> >> string exception contains.
> >
> > No, translation would have to be provided via a string table. And guess who
> > provides the key for that table.
> 
> But what Sergey is pointing out is that
> 1) if you rely on a human readable string for the key, then you have
> to fix things when some maintenance programmer fixes a spelling error
> in the message
> 2) if you rely on human readable strings in that are in 3rd party
> libraries then you have to find all those strings some how.  Could be
> difficult without source.
> 
> So if you're going to translate then having an actual key, a unique
> identifying symbol not meant for human consumption, is a better
> approach.

Correct.  Thank you for putting this together.  But there is even more to 
it than that: the library exceptions are usually too low-level and too 
specific to spit at the user as is.  They need to be analysed and 
converted into a more appropriate form or action.  And exception must 
provide means for such analysis other than message string parsing.



More information about the Digitalmars-d mailing list