Yes, the WHICH method controls how the hashing happens.
But the more fundamental principle is that the method always return
the same value for the same objects. This tends to be implemented by
returning either (a representation of) the reference, or the value
itself (which must then not be mutable
Thanks, Carl, that helps. I just need to add a WHICH method. great.
Theo
Theo van den Heuvel (>):
> Perl6 considers all entries as new, and the hash has 3 separate entries. Do
> I actually have to project my objects to strings to accomplish this?
You're putting arrays into a hash. When you put something into a hash,
it matters whether the object in question has *refere
Hi all,
I was hoping to store objects of class Foo in a BagHash in the
expectation that objects that are "the same" share their keys. But if I
do something like
my $b = BagHash.new();
for 1..3 {
$b{['foo']}++;
}
say $b.perl;
#(perl6 version 2014.09 built on MoarVM version 2014.09, Window