On Tuesday 23 July 2002 08:44 am, Alberto Manuel Brandão Simões wrote:
> On Tue, 2002-07-23 at 09:27, Ashley Winters wrote:
> > @foo = ();
> > %hash{@foo} = 10;
> > push @foo, 'This would change the hash key for @foo?';
> >
> > print "ok 1" if exists %hash{ [] };
> > print "ok 2" if exists %hash{ ['This would change the hash key for
> > @foo?'] }; print "ok 3" if exists %hash{@foo};
> >
> > What's going to get printed from that?
>
> IMHO, it should print 'ok 1'. The idea of the hash function is to use
> PMC's as hash keys. That means that different content PMC (as an array
> with different elements) must return different hash keys.

I can see the argument both ways, but I have a proposal.

@foo = (1 .. 100);
%hash{@foo} = "reference";
%hash{@foo.freeze} = "contents";

%hash{@foo} eq "reference";
%hash{[1..100].freeze} eq "contents";

I'm just using "freeze" as the serialization routine until a real name is 
determined. If I need a "unique" key for hashing based on aggregate content, 
can I ass_u_me the builtin Perl6/Python/etc serialization mechanism will 
suffice?

Ashley Winters

-- 
When you do the community's rewrite, try to remember most of us are idiots.

Reply via email to