Let's first compare with a PerlArray:
(following snippet is from an imcc test file, in PASM syntax)
new P1, .PerlArray
new P0, .PerlArray
set P1[0], P0
set P0[1], 2
set I0, P1[0;1]
print I0 => 2
i.e. "P1[0;.." returns an array PMC, which, indexed by key_next, gives
the final result, which is @a[0][1] in perl6 - DWIM.
This is functional with variables as keys too.
set I0, 1
set I1, 1
set I2, P1[I0;I1]
print I2 => 2
The same system with a PerlHash doesn't:
new P2, .PerlHash
set P2["a"], P1 # P1 from above
set I0, P2["a";0;1] => DWIM = 2, but isn't:
"PerlHash does not support compound keys!"
So the question arises to the syntax gurus, should it work like this?
and is a perl6 %h{"a"}[0][1] a PASM P2["a";0;1]?
Implementation notes:
- the hash will be indexed by the first key component (a string)
- when the key has no key_next then old behaviour
- when there is a key_next: return the _keyed vtable method of the
found hash_entry with key_next as key.
So this should then behave like above with arrays.
Comments welcome
leo