Re: UT_Pair


Subject: Re: UT_Pair
From: Sam TH (sam@uchicago.edu)
Date: Fri Nov 10 2000 - 09:15:06 CST


On Fri, Nov 10, 2000 at 04:10:33PM +0100, Mike Nordell wrote:
> This might be nit-picking to some.
>
> The name "pair" (obviously?) suggested to me it's a template-less "pair"
> (from ISO C++).
>
> Looking at this class, I realize it's nothing like that. It's more of a
> map<string,string>
> with the exception that it can also map "backwards" (i.e. from "second"
> (value) to "first" (key)).
>
> Since (currently) not too much depend upon this classname, may I humbly
> suggest the following changes (in no particular order)?
> - it gets renamed to something like UT_stringmap
> - it uses it's own type UT_Pair::pair_data instead of the two char** members
> - its pair_data gets renamed to something like string_pair
> - the two getXxx members gets renamed to something like lookupFirst,
> lookupSecond and perhaps returntype should be changed to the nested
> pair_data (I'm not sure though).
> - its member "add" taking a "const pair_data*" gets changed to take a "const
> pair_data[]" *and* a size_t telling how many entries it should add.
> - its member "add" taking two const char* asserts that the arguments are not
> NULL.
>
> As I wrote, it might be nit-picking, and I sure didn't intend to tick anyone
> off by this, but the whole is the product of the details. :-)

My only response is - "It's not nitpicking if you provide the patch."

:-)

Seriously, I think this is a good idea. And I hope you will write it.
           
        sam th
        sam@uchicago.edu
        http://www.abisource.com/~sam/
        GnuPG Key:
        http://www.abisource.com/~sam/key




This archive was generated by hypermail 2b25 : Fri Nov 10 2000 - 09:15:07 CST