[kw-pm] a philosophical question about hashes

Robert P. J. Day rpjday at mindspring.com
Wed Jun 15 13:54:10 PDT 2005


On Wed, 15 Jun 2005, Daniel R. Allen wrote:

> It might be more convenient to have the key repeated; it doesn't
> strike me as terribly inelegant.
>
> It could make accessing the key back out again, simpler.  You could
> alternately do that by treating the key as a special case when
> retrieving all the values, but that's a bit more code, by my
> thinking.

my major concern with repeating the key in the values hash is that it
leaves open the possibility of an error somewhere making these two
values unequal, which should naturally never happen but now it would
at least be technically possible.

most of the time, i'm a real big fan of never repeating myself in
terms of data definition -- that just leads to trouble.

rday


More information about the kw-pm mailing list