On Tue, Sep 25, 2001 at 07:29:01PM -0700, Wizard wrote:
> Actually, the thing that I didn't like was using an actual string as the
> message_id. I would have expected something more in the way of:
> 
> char *err = get_text_string( THREAD_EXCEPTION_117, \
>                               "THREAD EXCEPTION: Not enough handles." );

This is a far more error-prone interface in a number of ways:  It
is very easy for the mapping between the number and the string to
be lost.  Adding and removing strings is harder: the string list
will become filled with holes (or must be renumbered), and the
numeric order of the strings will probably not correspond with the
logical order.  Numerically indexes are far more prone to failure
when using out-of-date catalog files, while string-indexed ones
will mostly continue to work.  (With the obvious exception that
messages not contained in the old catalog cannot be displayed from
it.)

All these disadvantages are a significant penalty to pay for a very
minor improvement in efficiency.  (If there is one thing that Perl
has demonstrated, it is that looking up a string in a hash is fast.)

                        - Damien

Reply via email to