On Wed, 2002-07-24 at 12:34, Fisher Mark wrote:
> > But then sometimes you'd *want* hashing to be based on the
> > content.
>
> OK, I'll bite -- when would you want this behavior? This behavior means
> that once you change the contents, the hash value would become irretrievable
> unless you restored the contents of the key. (Is this useful in functional
> programming?)
That's no more true than in this case:
$x = "abc";
%h = ($x => 1);
$x = "123";
%h{"abc"} is still 1, not undefined. So to, in this case:
my @x is Hashed::ByValues = (1,2,3);
%h = (@x => 1);
@x[1] += 4;
%h{[1,2,3]} should still be 1, not undefined. Is this ever useful? Of
course! You're just associating a unique collection to some value. There
are any number of places where you would want to do that.