develooper Front page | perl.perl6.internals | Postings from July 2002

RE: RFC - Hashing PMC's <>

Thread Previous | Thread Next
Aaron Sherman
July 24, 2002 11:08
RE: RFC - Hashing PMC's <>
Message ID:
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.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About