Leopold Toetsch <[EMAIL PROTECTED]> writes: > Togos <[EMAIL PROTECTED]> wrote: >> Should aggregate PMCs (like PerlHash) be able to take >> PMCs as keys? I mean so that: > >> $P0 = $P1[$P2] > > Just use a Key PMC for $P2. > > $P2 = new Key > $P2 = "key_string" > ...
So, just for fun I added the following test to t/pmc/perlhash.t: new P10, .PerlHash new P1, .PerlString set P1, "Bar" new P2, .Key set P2, P1 set P10[P2], "Food\n" set S0, P10[P2] print S0 new P3, .Key set P2, P1 set S1, P10[P2] print S1 end Just to test that two Keys created from the same PMC would fetch the same thing from the hash. Imagine my surprise when the test blew up with 'Key not a string!' before producing any output. Perl 6 supports using full on objects as keys in its hashes. It seems that having parrot do the same would be a Good Thing.